MCPcopy Create free account
hub / github.com/bshoshany/thread-pool / detect_cpp_standard

Function detect_cpp_standard

tests/BS_thread_pool_test.cpp:632–643  ·  view source on GitHub ↗

* @brief Detect the C++ standard used to compile this program. * * @return A string describing the C++ standard. */

Source from the content-addressed store, hash-verified

630 * @return A string describing the C++ standard.
631 */
632std::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.

Callers 1

show_introFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected