// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page cpp20-overview.html
    \title C++20 Overview
    \brief An overview of C++20 features available in Qt.

    Qt 6 officially requires C++17, however we are constantly working on
    supporting new C++ language features to make Qt faster and safer, and
    provide a better experience for our users.

    This page gives a brief overview of C++20 features available in Qt.

    \section1 Support for \c{std::chrono}

    Various classes related to date and time have support for \l
    {https://en.cppreference.com/w/cpp/chrono} {std::chrono} features from older
    versions of C++. With the arrival of C++20, \c{std::chrono} has added new \l
    {https://en.cppreference.com//w/cpp/chrono#Calendar} {calendar types}, such
    as \l {https://en.cppreference.com/w/cpp/chrono/year_month_day}
    {year_month_day}, plus \l
    {https://en.cppreference.com//w/cpp/chrono#Time_point} {date and time
    representations}, such as the \l
    {https://en.cppreference.com/w/cpp/chrono/system_clock} {system_clock} and
    its \l {https://en.cppreference.com/w/cpp/chrono/time_point} {time_point}
    types. When Qt is built with C++20, it can now make use of these additions.

    QDate and QDateTime now support conversion to and from the various calendar,
    date and date-time types, along with addition of \l
    {https://en.cppreference.com/w/cpp/chrono/duration} {duration
    types}. QTimeZone now supports construction from a \l
    {https://en.cppreference.com/w/cpp/chrono/time_zone} {time_zone}.

    \section1 QSpan - a Qt version of \c {std::span}

    The \l {https://en.cppreference.com/w/cpp/container/span}{std::span} class
    template is an addition to the standard library that provides a uniform
    way to access a contiguous portion of any contiguous container.

    Using \c {std::span} in the public APIs of Qt could provide significant
    advantages. However, Qt 6 only requires C++17, meaning it cannot have C++20
    types in the API and ABI.

    Qt 6.7 introduced \l QSpan - a Qt version of \c {std::span}. The API of the
    class is compatible with the std version. \l QSpan and \c {std::span} can be
    implicitly converted into each other. However, there are some differences
    between the classes. See the corresponding section in the
    \l {span-STL} {QSpan class documentation} for more details.

    \section1 Additional important features

    Qt has also adopted a few more features from C++20, such as:

    \list
        \li \l Q_CONSTINIT macro that expands to the C++20 \c {constinit}
            keyword, or to compiler-specific attributes if they are available
        \li \l Q_NODISCARD_CTOR macro that expands to the \c {[[nodiscard]]}
            attribute if the compiler supports \c {[[nodiscard]]} on
            constructors
        \li \l Q_NODISCARD_X and \l Q_NODISCARD_CTOR_X macros for
            \c {[[nodiscard("reason")]]}
    \endlist
*/
