diff --git a/CMakeLists.txt b/CMakeLists.txt index 82d74b1d..fe64006b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ option (TEQP_MULTICOMPLEX_ENABLED #### SETUP -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(ZIPFN "${CMAKE_CURRENT_SOURCE_DIR}/dev/docker/boost_bcp_docker/boost_teqp.tar.xz") set(OUTFN "${CMAKE_CURRENT_SOURCE_DIR}/boost_teqp/boost/version.hpp") diff --git a/src/tests/catch_test_concepts.cxx b/src/tests/catch_test_concepts.cxx new file mode 100644 index 00000000..d28adc65 --- /dev/null +++ b/src/tests/catch_test_concepts.cxx @@ -0,0 +1,44 @@ +#include +#include +#include +using Catch::Approx; + +#include +#include + +template +concept UsesTauDelta = requires(T t) { + { t.has_alphar_taudelta } -> std::same_as; +}; + +template +concept DoesntUseTauDelta = requires(T t) { + { t.has_alphar_taudelta } -> std::same_as; +}; + +void get(auto t){ + if constexpr (UsesTauDelta){ + std::cout << "Defined and used" << std::endl; + } + else if constexpr (DoesntUseTauDelta){ + std::cout << "Defined and not used" << std::endl; + } + else{ + std::cout << "unknown" << std::endl; + } +} + +struct Adeftrue{ + std::false_type has_alphar_taudelta; +}; + +struct Bdeffalse{ + std::true_type has_alphar_taudelta; +}; +struct C{ +}; + +TEST_CASE("Test some C++20 things", "[C++20]"){ + static_assert(DoesntUseTauDelta); + static_assert(UsesTauDelta); +}