diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-08-10 16:14:30 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-08-14 19:19:59 +0200 |
commit | 742fdf7d20936cd71a009f96dfb94610b336bc97 (patch) | |
tree | 600932d0866bbaf43647ee59f8826b2f35dd6fe1 /compat/functional.hpp | |
parent | 07f16d4ff648fee65cb3f7aaf313e9616179e9d0 (diff) |
use c++14 features
Diffstat (limited to 'compat/functional.hpp')
-rw-r--r-- | compat/functional.hpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compat/functional.hpp b/compat/functional.hpp index fcf6393c..f7cd95c7 100644 --- a/compat/functional.hpp +++ b/compat/functional.hpp @@ -5,9 +5,6 @@ #include <type_traits> #include <vector> -template<typename t> -using remove_qualifiers = std::remove_cv_t<std::remove_reference_t<t>>; - namespace functools { @@ -53,8 +50,8 @@ struct constant final template<typename seq_, typename F> auto map(F&& fun, const seq_& seq) { - using value_type = remove_qualifiers<typename std::iterator_traits<decltype(std::begin(seq))>::value_type>; - using ret_type = remove_qualifiers<decltype(fun(std::declval<value_type>()))>; + using value_type = std::decay_t<typename std::iterator_traits<decltype(std::begin(seq))>::value_type>; + using ret_type = std::decay_t<decltype(fun(std::declval<value_type>()))>; std::vector<ret_type> ret; auto it = std::back_inserter(ret); @@ -70,8 +67,8 @@ auto remove_if_not(F&& fun, const seq_& seq) { using namespace functools; - using seq_type = remove_qualifiers<seq_>; - using value_type = remove_qualifiers<typename std::iterator_traits<decltype(std::begin(seq))>::value_type>; + 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"); |