From b8bcaa92d0fe795c2da2a70a33390274ab03d0cd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 9 Jul 2017 15:01:41 +0200 Subject: compat/functional: fix template --- compat/functional.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'compat/functional.hpp') diff --git a/compat/functional.hpp b/compat/functional.hpp index 893fe1a0..fcf6393c 100644 --- a/compat/functional.hpp +++ b/compat/functional.hpp @@ -3,9 +3,10 @@ #include #include #include +#include template -using remove_qualifiers = std::remove_reference_t>; +using remove_qualifiers = std::remove_cv_t>; namespace functools { @@ -52,10 +53,11 @@ struct constant final template auto map(F&& fun, const seq_& seq) { - using seq_type = remove_qualifiers; + using value_type = remove_qualifiers::value_type>; + using ret_type = remove_qualifiers()))>; - seq_type ret; - std::back_insert_iterator it = std::back_inserter(ret); + std::vector ret; + auto it = std::back_inserter(ret); for (const auto& elt : seq) it = fun(elt); @@ -69,8 +71,8 @@ auto remove_if_not(F&& fun, const seq_& seq) using namespace functools; using seq_type = remove_qualifiers; - using value_type = typename std::iterator_traits()))>::value_type; - using fun_ret_type = decltype(fun(std::declval())); + using value_type = remove_qualifiers::value_type>; + using fun_ret_type = decltype(fun(std::declval())); static_assert(std::is_convertible::value, "must return bool"); seq_type ret; -- cgit v1.2.3