From 1377ed8d275bdf54b0858889b88422a5d3fafd8f Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Wed, 10 Jan 2024 10:40:57 -0500 Subject: [PATCH] [FOLD] test static_string as NTTP --- test/constexpr_tests.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/constexpr_tests.hpp b/test/constexpr_tests.hpp index 9b2e83c..392eb3a 100644 --- a/test/constexpr_tests.hpp +++ b/test/constexpr_tests.hpp @@ -605,5 +605,28 @@ testConstantEvaluation() cstatic_string().empty(); #endif } + +#ifdef BOOST_STATIC_STRING_CPP20 + +template X> +struct nttp_primary +{ + static constexpr bool value = false; +}; + +template<> +struct nttp_primary<"test string"> +{ + static constexpr bool value = true; +}; + +static_assert(!nttp_primary<"random string">::value, + "structural equality broken"); + +static_assert(nttp_primary<"test string">::value, + "structural equality broken"); + +#endif + } // static_strings } // boost \ No newline at end of file