diff --git a/include/stdx/concepts.hpp b/include/stdx/concepts.hpp index 01f61d2..b7287c3 100644 --- a/include/stdx/concepts.hpp +++ b/include/stdx/concepts.hpp @@ -41,6 +41,12 @@ constexpr auto derived_from = template constexpr auto same_as = std::is_same_v and std::is_same_v; +template +constexpr auto same_any = (... or same_as); + +template +constexpr auto same_none = not same_any; + template constexpr auto same_as_unqualified = is_same_unqualified_v and is_same_unqualified_v; @@ -130,6 +136,12 @@ concept derived_from = template concept same_as = std::is_same_v and std::is_same_v; +template +constexpr auto same_any = (... or same_as); + +template +constexpr auto same_none = not same_any; + template concept same_as_unqualified = is_same_unqualified_v and is_same_unqualified_v; @@ -222,6 +234,11 @@ concept same_as_unqualified = template concept structural = is_structural_v; +template +constexpr auto same_any = (... or same_as); + +template +constexpr auto same_none = not same_any; } // namespace v1 } // namespace stdx diff --git a/test/concepts.cpp b/test/concepts.cpp index cddec5b..de354ae 100644 --- a/test/concepts.cpp +++ b/test/concepts.cpp @@ -30,6 +30,16 @@ TEST_CASE("same_as", "[concepts]") { static_assert(not stdx::same_as); } +TEST_CASE("same_any", "[concepts]") { + static_assert(stdx::same_any); + static_assert(not stdx::same_any); +} + +TEST_CASE("same_none", "[concepts]") { + static_assert(stdx::same_none); + static_assert(not stdx::same_none); +} + TEST_CASE("same_as_unqualified", "[concepts]") { static_assert(stdx::same_as_unqualified); static_assert(not stdx::same_as_unqualified);