expected-lite
expected-lite copied to clipboard
Use C++20 library feature tests
The following code breaks when it is compiled with a C++20 capable compiler without using a C++20 capable standard library:
#if nsel_CPP20_OR_GREATER
using std::remove_cvref;
#else
Please don't assume that C++20 library features are available depending on the language standard that was selected with -std=
.
Instead, check for each feature individually, as in
#if defined(__cpp_lib_remove_cvref)
using std::remove_cvref;
#else
See the list of feature tests here: https://en.cppreference.com/w/cpp/feature_test