Skip to content

Commit 53fccb9

Browse files
Geod24dlang-bot
authored andcommitted
core.stdcpp.xutility: Add C++20 and a bit of documentation
1 parent 9b17410 commit 53fccb9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/core/stdcpp/xutility.d

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,27 @@ else
2323
enum StdNamespace = "std";
2424
}
2525

26+
/**
27+
* Possible values of the `__cplusplus` macro provided by C++ compilers
28+
*
29+
* For foolproofness, use ordering comparison, e.g. `__cplusplus >= CppStdRevision.cpp17`.
30+
*/
2631
enum CppStdRevision : uint
2732
{
2833
cpp98 = 199711,
2934
cpp11 = 201103,
3035
cpp14 = 201402,
31-
cpp17 = 201703
36+
cpp17 = 201703,
37+
cpp20 = 202002,
3238
}
3339

40+
/**
41+
* Returns the target C++ version, encoded as C++ compilers do
42+
*
43+
* C++ compilers provide a `__cplusplus` macro which returns an integer
44+
* representing the targetted standard. This manifest provides the same
45+
* interface, retrieved from the compiler via a `__traits`.
46+
*/
3447
enum __cplusplus = __traits(getTargetInfo, "cppStd");
3548

3649
// wrangle C++ features

0 commit comments

Comments
 (0)