diff --git a/docs/type_traits.adoc b/docs/type_traits.adoc index b0bae5f..7724bcf 100644 --- a/docs/type_traits.adoc +++ b/docs/type_traits.adoc @@ -7,9 +7,7 @@ contains a few things from the standard: * https://en.cppreference.com/w/cpp/types/conditional[`conditional_t`] (implemented with fewer template instantiations than a typical standard implementation) -* https://en.cppreference.com/w/cpp/types/is_constant_evaluated[`is_constant_evaluated`] (from C++20) * https://en.cppreference.com/w/cpp/types/is_function[`is_function_v`] (implemented with Walter Brown's method) -* https://en.cppreference.com/w/cpp/types/is_scoped_enum[`is_scoped_enum_v`] (from C++23) * https://en.cppreference.com/w/cpp/utility/to_underlying[`to_underlying`] (from C++23) * https://en.cppreference.com/w/cpp/types/type_identity[`type_identity`] (from C++20) diff --git a/include/stdx/tuple.hpp b/include/stdx/tuple.hpp index 59ec39f..adfacb9 100644 --- a/include/stdx/tuple.hpp +++ b/include/stdx/tuple.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include #include @@ -27,7 +28,6 @@ template struct tag_constant; template constexpr static tag_constant *tag{}; namespace error { -template constexpr auto always_false_v = false; template struct type_from_tag_constant { using type = T; }; diff --git a/include/stdx/type_traits.hpp b/include/stdx/type_traits.hpp index 0ab46de..9381289 100644 --- a/include/stdx/type_traits.hpp +++ b/include/stdx/type_traits.hpp @@ -66,10 +66,6 @@ constexpr bool is_function_object_v = detail::is_func_obj; template constexpr bool is_callable_v = is_function_v or is_function_object_v; -constexpr auto is_constant_evaluated() noexcept -> bool { - return __builtin_is_constant_evaluated(); -} - template struct type_identity { using type = T; }; @@ -115,12 +111,6 @@ constexpr auto is_specialization_of() return {}; } -template -constexpr bool is_scoped_enum_v = - std::is_enum_v and not std::is_convertible_v>; -template -using is_scoped_enum = std::bool_constant>; - template struct type_list {}; template struct value_list {}; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ea04c68..7b497b5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -53,7 +53,6 @@ add_tests( intrusive_forward_list intrusive_list intrusive_list_properties - is_constant_evaluated iterator latched numeric diff --git a/test/is_constant_evaluated.cpp b/test/is_constant_evaluated.cpp deleted file mode 100644 index c0e9615..0000000 --- a/test/is_constant_evaluated.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -#include - -namespace { -constexpr auto f() -> int { - if (stdx::is_constant_evaluated()) { - return 42; - } else { - return 0; - } -} -} // namespace - -TEST_CASE("constexpr context", "[is_constant_evaluated]") { - constexpr auto n = f(); - CHECK(n == 42); -} - -TEST_CASE("runtime context", "[is_constant_evaluated]") { - auto n = f(); - CHECK(n == 0); -} diff --git a/test/type_traits.cpp b/test/type_traits.cpp index 80583ff..ecffbce 100644 --- a/test/type_traits.cpp +++ b/test/type_traits.cpp @@ -71,21 +71,6 @@ TEST_CASE("derived types are not specializations (value templates)", not stdx::is_specialization_of, value_unary_t>()); } -namespace { -enum E1 {}; -enum struct E2 {}; -} // namespace - -TEST_CASE("is_scoped_enum", "[type_traits]") { - STATIC_REQUIRE(not stdx::is_scoped_enum_v); - STATIC_REQUIRE(not stdx::is_scoped_enum_v); - STATIC_REQUIRE(stdx::is_scoped_enum_v); - - STATIC_REQUIRE(not stdx::is_scoped_enum::value); - STATIC_REQUIRE(not stdx::is_scoped_enum::value); - STATIC_REQUIRE(stdx::is_scoped_enum::value); -} - TEST_CASE("type_identity", "[type_traits]") { STATIC_REQUIRE(std::is_same_v, void>); }