diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-09-23 19:21:45 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-09-23 19:21:45 +0200 |
commit | ec34d6575fa03f1e137739ee1946f0ba9d3f2830 (patch) | |
tree | 7aa2ba948a8c2656145aa60f992aad8d96f33534 | |
parent | 40c45a336489103b1da50e07479dd2808ae304d6 (diff) |
compat: use c++17-style value templates
-rw-r--r-- | compat/functional.hpp | 4 | ||||
-rw-r--r-- | compat/powerset.hpp | 6 | ||||
-rw-r--r-- | options/value-traits.hpp | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/compat/functional.hpp b/compat/functional.hpp index f7cd95c7..dcba0538 100644 --- a/compat/functional.hpp +++ b/compat/functional.hpp @@ -1,5 +1,7 @@ #pragma once +#include "value-templates.hpp" + #include <algorithm> #include <iterator> #include <type_traits> @@ -70,7 +72,7 @@ auto remove_if_not(F&& fun, const seq_& seq) using seq_type = std::decay_t<seq_>; using value_type = std::decay_t<typename std::iterator_traits<decltype(std::begin(seq))>::value_type>; using fun_ret_type = decltype(fun(std::declval<value_type>())); - static_assert(std::is_convertible<fun_ret_type, bool>::value, "must return bool"); + static_assert(is_convertible_v<fun_ret_type, bool>, "must return bool"); seq_type ret; maybe_reserve_space(ret, seq.size()); diff --git a/compat/powerset.hpp b/compat/powerset.hpp index ad7b07b0..fa49307e 100644 --- a/compat/powerset.hpp +++ b/compat/powerset.hpp @@ -1,5 +1,7 @@ #pragma once +#include "util.hpp" + #include <type_traits> #include <cinttypes> #include <vector> @@ -12,13 +14,13 @@ template<typename t, int M, typename size_type_ = std::uintptr_t> struct powerset final { - static_assert(std::is_integral<size_type_>::value, ""); + static_assert(is_integral_v<size_type_>, ""); using size_type = size_type_; static_assert(M > 0, ""); static_assert(M < sizeof(size_type[8]), ""); - static_assert(std::is_unsigned<size_type>::value || M < sizeof(size_type)*8 - 1, ""); + static_assert((is_unsigned_v<size_type>) || M < sizeof(size_type)*8 - 1, ""); using N = std::integral_constant<size_type, (size_type(1) << size_type(M))-1>; static_assert((N::value & (N::value + 1)) == 0, ""); diff --git a/options/value-traits.hpp b/options/value-traits.hpp index 8a497aca..d1a64da8 100644 --- a/options/value-traits.hpp +++ b/options/value-traits.hpp @@ -37,7 +37,7 @@ struct value_traits<slider_value> : default_value_traits<slider_value> // Qt uses int a lot in slots so use it for all enums template<typename t> -struct value_traits<t, t, std::enable_if_t<std::is_enum<t>::value>> : public default_value_traits<int, t> +struct value_traits<t, t, std::enable_if_t<is_enum_v<t>>> : public default_value_traits<int, t> { }; |