diff options
-rw-r--r-- | common/albyte.h | 2 | ||||
-rw-r--r-- | common/aloptional.h | 6 | ||||
-rw-r--r-- | common/alspan.h | 15 |
3 files changed, 10 insertions, 13 deletions
diff --git a/common/albyte.h b/common/albyte.h index 23864636..40a10d04 100644 --- a/common/albyte.h +++ b/common/albyte.h @@ -13,7 +13,7 @@ namespace al { */ enum class byte : unsigned char { }; -#define REQUIRES(...) typename std::enable_if<(__VA_ARGS__),bool>::type = true +#define REQUIRES(...) std::enable_if_t<(__VA_ARGS__),bool> = true template<typename T, REQUIRES(std::is_integral<T>::value)> inline constexpr T to_integer(al::byte b) noexcept { return T(b); } diff --git a/common/aloptional.h b/common/aloptional.h index 269cba0e..f19bc288 100644 --- a/common/aloptional.h +++ b/common/aloptional.h @@ -9,7 +9,7 @@ namespace al { -#define REQUIRES(...) bool rt_=true, typename std::enable_if<rt_ && (__VA_ARGS__),bool>::type = true +#define REQUIRES(...) bool rt_=true, std::enable_if_t<rt_ && (__VA_ARGS__),bool> = true struct nullopt_t { }; struct in_place_t { }; @@ -131,8 +131,8 @@ public: }; template<typename T> -inline optional<typename std::decay<T>::type> make_optional(T&& arg) -{ return optional<typename std::decay<T>::type>{in_place, std::forward<T>(arg)}; } +inline optional<std::decay_t<T>> make_optional(T&& arg) +{ return optional<std::decay_t<T>>{in_place, std::forward<T>(arg)}; } template<typename T, typename... Args> inline optional<T> make_optional(Args&& ...args) diff --git a/common/alspan.h b/common/alspan.h index 046b7d76..9aa30fc2 100644 --- a/common/alspan.h +++ b/common/alspan.h @@ -57,14 +57,14 @@ namespace detail_ { template<typename T, size_t E> struct is_span_<span<T,E>> : std::true_type { }; template<typename T> - using is_span = is_span_<typename std::remove_cv<T>::type>; + using is_span = is_span_<std::remove_cv_t<T>>; template<typename T> struct is_std_array_ : std::false_type { }; template<typename T, size_t N> struct is_std_array_<std::array<T,N>> : std::true_type { }; template<typename T> - using is_std_array = is_std_array_<typename std::remove_cv<T>::type>; + using is_std_array = is_std_array_<std::remove_cv_t<T>>; template<typename T, typename = void> struct has_size_and_data : std::false_type { }; @@ -72,16 +72,13 @@ namespace detail_ { struct has_size_and_data<T, void_t<decltype(al::size(std::declval<T>())), decltype(al::data(std::declval<T>()))>> : std::true_type { }; - - template<typename T> - using remove_pointer_t = typename std::remove_pointer<T>::type; } // namespace detail_ -#define REQUIRES(...) bool rt_=true, typename std::enable_if<rt_ && (__VA_ARGS__),bool>::type = true +#define REQUIRES(...) bool rt_=true, std::enable_if_t<rt_ && (__VA_ARGS__),bool> = true #define IS_VALID_CONTAINER(C) \ !detail_::is_span<C>::value && !detail_::is_std_array<C>::value && \ !std::is_array<C>::value && detail_::has_size_and_data<C>::value && \ - std::is_convertible<detail_::remove_pointer_t<decltype(al::data(std::declval<C&>()))>(*)[],element_type(*)[]>::value + std::is_convertible<std::remove_pointer_t<decltype(al::data(std::declval<C&>()))>(*)[],element_type(*)[]>::value template<typename T, size_t E> class span { @@ -89,7 +86,7 @@ class span { public: using element_type = T; - using value_type = typename std::remove_cv<T>::type; + using value_type = std::remove_cv_t<T>; using index_type = size_t; using difference_type = ptrdiff_t; @@ -182,7 +179,7 @@ class span<T,static_cast<size_t>(-1)> { public: using element_type = T; - using value_type = typename std::remove_cv<T>::type; + using value_type = std::remove_cv_t<T>; using index_type = size_t; using difference_type = ptrdiff_t; |