diff options
Diffstat (limited to 'doc/tutorial.qdoc')
-rw-r--r-- | doc/tutorial.qdoc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/tutorial.qdoc b/doc/tutorial.qdoc index c076d054a..a04d3b3af 100644 --- a/doc/tutorial.qdoc +++ b/doc/tutorial.qdoc @@ -726,4 +726,36 @@ For more details, see the complete \l{https://github.com/qbs/qbs/tree/2.5/tutorial/chapter-10-2}{example}. + + \section1 Import std module + + Starting with C++23, you can use the standard library as a module by using \c{import std;} or + \c{import std.compat;}. + + In order to use \c{import std;}, you need to set the + \l{cpp::forceUseImportStd}{cpp.forceUseImportStd} property to \c{true}. + + Here's a simple example that demonstrates the use of the standard library module: + + \snippet ../tutorial/chapter-10-3/main.cpp 0 + + The project file needs to be configured to use C++23 and enable the standard library module: + + \snippet ../tutorial/chapter-10-3/myproject.qbs 0 + + \note This feature requires a compiler and standard library that support the C++23 standard + library module. Currently, this feature is experimental and may not be available in all + toolchains. + + The full product file may look like this: + + \snippet ../tutorial/chapter-10-3/myproject.qbs 1 + + In order to use \c{import std.compat;}, you will also need to set the + \l{cpp::forceUseImportStdCompat}{cpp.forceUseImportStdCompat} to \c{true}: + + \code + cpp.forceUseImportStd: true + cpp.forceUseImportCompatStd: true + \endcode */
\ No newline at end of file |