summaryrefslogtreecommitdiffhomepage
path: root/compat/functional.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/functional.hpp')
-rw-r--r--compat/functional.hpp11
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");