Skip to content

Commit

Permalink
Simplify is_any_char
Browse files Browse the repository at this point in the history
  • Loading branch information
jimporter committed May 2, 2024
1 parent 07b9ae8 commit 263f050
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions include/mettle/output/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@
#include <type_traits>

namespace mettle {

namespace detail {
template<typename T>
struct is_any_char_helper : std::false_type {};

template<> struct is_any_char_helper<char> : std::true_type {};
template<> struct is_any_char_helper<signed char> : std::true_type {};
template<> struct is_any_char_helper<unsigned char> : std::true_type {};

template<> struct is_any_char_helper<wchar_t> : std::true_type {};
template<> struct is_any_char_helper<char16_t> : std::true_type {};
template<> struct is_any_char_helper<char32_t> : std::true_type {};
}

template<typename T>
struct is_any_char : detail::is_any_char_helper<std::remove_cv_t<T>> {};
template<typename T> struct is_any_char : std::false_type {};
template<typename T> struct is_any_char<const T> : is_any_char<T> {};
template<typename T> struct is_any_char<volatile T> : is_any_char<T> {};
template<typename T> struct is_any_char<const volatile T> : is_any_char<T> {};

template<> struct is_any_char<char> : std::true_type {};
template<> struct is_any_char<signed char> : std::true_type {};
template<> struct is_any_char<unsigned char> : std::true_type {};

template<> struct is_any_char<wchar_t> : std::true_type {};
template<> struct is_any_char<char16_t> : std::true_type {};
template<> struct is_any_char<char32_t> : std::true_type {};

template<typename T>
using is_exception = std::is_base_of<std::exception, T>;
Expand Down

0 comments on commit 263f050

Please sign in to comment.