* @brief Detect the C++ standard used to compile this program. * * @return A string describing the C++ standard. */
| 630 | * @return A string describing the C++ standard. |
| 631 | */ |
| 632 | std::string detect_cpp_standard() |
| 633 | { |
| 634 | #if __cplusplus == 201703L |
| 635 | return "C++17"; |
| 636 | #elif __cplusplus == 202002L |
| 637 | return "C++20"; |
| 638 | #elif (__cplusplus == 202302L) || (defined(_MSC_VER) && __cplusplus > 202002L) // MSVC with `/std:c++latest` only guarantees `__cplusplus` is "at least one higher" than the highest supported version. |
| 639 | return "C++23"; |
| 640 | #else |
| 641 | return "Other"; |
| 642 | #endif |
| 643 | } |
| 644 | |
| 645 | /** |
| 646 | * @brief Detect the C++ standard library used to compile this program. |