diff --git a/include/rexy/cx/string.hpp b/include/rexy/cx/string.hpp index 65ba621..79fb66d 100644 --- a/include/rexy/cx/string.hpp +++ b/include/rexy/cx/string.hpp @@ -30,7 +30,8 @@ namespace rexy::cx{ #include "../string_view.hpp" #include "../utility.hpp" //strlen, strcmp #include "../detail/string_appender.hpp" -#include //nothrow_invocable, integral_constant, declval, remove_cvref_t +#include "../traits.hpp" //remove_cvref +#include //nothrow_invocable, integral_constant, declval #include //reverse_iterator #include "../compat/standard.hpp" @@ -224,7 +225,7 @@ namespace rexy::cx{ template static std::true_type check(cx::string); static std::false_type check(...); - static constexpr bool value = (decltype(check(std::declval>()))::value && ...); + static constexpr bool value = (decltype(check(std::declval>()))::value && ...); }; } diff --git a/include/rexy/traits.hpp b/include/rexy/traits.hpp index 55843aa..6822344 100644 --- a/include/rexy/traits.hpp +++ b/include/rexy/traits.hpp @@ -54,6 +54,60 @@ namespace rexy{ static constexpr bool value = std::is_same*>(nullptr)))>::value; }; +#ifdef REXY_STANDARD_CPP20 + template + struct remove_cvref : public std::remove_cvref{}; + template + using remove_cvref_t = typename remove_cvref::type; +#else // REXY_STANDARD_CPP26 + template + struct remove_volatile{ + using type = T; + }; + template + struct remove_volatile{ + using type = T; + }; + template + using remove_volatile_t = typename remove_volatile::type; + template + struct remove_const{ + using type = T; + }; + template + struct remove_const{ + using type = T; + }; + template + using remove_const_t = typename remove_const::type; + template + struct remove_cv{ + using type = remove_volatile_t>; + }; + template + using remove_cv_t = typename remove_cv::type; + template + struct remove_reference{ + using type = T; + }; + template + struct remove_reference{ + using type = T; + }; + template + struct remove_reference{ + using type = T; + }; + template + using remove_reference_t = typename remove_reference::type; + template + struct remove_cvref{ + using type = remove_cv_t>; + }; + template + using remove_cvref_t = typename remove_cvref::type; +#endif // REXY_STANDARD_CPP26 + template struct is_dereferencable : public std::false_type{}; template @@ -73,14 +127,14 @@ namespace rexy{ template struct is_prefix_incrementable : public std::false_type{}; template - struct is_prefix_incrementable>>()))>> : public std::true_type{}; + struct is_prefix_incrementable>>()))>> : public std::true_type{}; template static constexpr bool is_prefix_incrementable_v = is_prefix_incrementable::value; template struct is_postfix_incrementable : public std::false_type{}; template - struct is_postfix_incrementable>>())++)>> : public std::true_type{}; + struct is_postfix_incrementable>>())++)>> : public std::true_type{}; template static constexpr bool is_postfix_incrementable_v = is_postfix_incrementable::value; @@ -115,8 +169,8 @@ namespace rexy{ struct is_legacy_input_iterator{ static constexpr bool value = std::is_convertible_v() == std::declval()),bool> && std::is_same_v())),typename std::iterator_traits::reference> && - std::is_same_v>>()),std::add_lvalue_reference_t> && - std::is_convertible_v>>()++), typename std::iterator_traits::value_type>; + std::is_same_v>>()),std::add_lvalue_reference_t> && + std::is_convertible_v>>()++), typename std::iterator_traits::value_type>; }; template static constexpr bool is_legacy_input_iterator_v = is_legacy_input_iterator::value; @@ -128,8 +182,8 @@ namespace rexy{ template struct is_legacy_output_iterator{ static constexpr bool value = - std::is_same_v>>()),std::add_lvalue_reference_t> && - std::is_convertible_v>>()++), std::add_lvalue_reference_t>>; + std::is_same_v>>()),std::add_lvalue_reference_t> && + std::is_convertible_v>>()++), std::add_lvalue_reference_t>>; }; template static constexpr bool is_legacy_output_iterator_v = is_legacy_output_iterator::value;