My understanding was the the best practice is:
#if __cplusplus >= 202002L
// code
#endif
However, it does not work, even though i do compile with -std=c++20
.
Also the output of g++ -x c++ -std=c++20 -dM -E - </dev/null | grep __cplusplus
is
#define __cplusplus 201709L
Which really confuses me, because i assumed that the correct define for c++17 is 201703L
Am i missing something?
P.S.
$ g++ --version
g++ (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1