Permalink
Browse files

C++17: More use of std::invoke().

The use of template operator() here was maybe to deal with
awkward compilers, but now we can just expect them to support
std::invoke() from C++17.
  • Loading branch information...
murraycu committed Apr 8, 2018
1 parent f3da00b commit 107d09760f152279d87a072a40462983334f3e09
@@ -49,8 +49,7 @@ struct bind_return_functor : public adapts<T_functor>
template <typename... T_arg>
inline typename unwrap_reference<T_return>::type operator()(T_arg... a)
{
//TODO: Use std::invoke() here?
this->functor_.template operator()<type_trait_pass_t<T_arg>...>(a...);
std::invoke(this->functor_, a...);
return ret_value_.invoke();
}
@@ -93,8 +93,7 @@ struct exception_catch_functor : public adapts<T_functor>
{
try
{
//TODO: Use std::invoke here?
return this->functor_.template operator()<type_trait_pass_t<T_arg>...>(a...);
return std::invoke(this->functor_, a...);
}
catch (...)
{
View
@@ -82,9 +82,7 @@ struct retype_functor : public adapts<T_functor>
template <typename... T_arg>
decltype(auto) operator()(T_arg... a)
{
//TODO: Use std::invoke() here?
return this->functor_.template operator()<type_trait_take_t<T_type>...>(
static_cast<T_type>(a)...);
return std::invoke(this->functor_, static_cast<T_type>(a)...);
}
/** Constructs a retype_functor object that performs C-style casts on the parameters passed on to
@@ -41,8 +41,7 @@ struct retype_return_functor : public adapts<T_functor>
template <typename... T_arg>
inline T_return operator()(T_arg&&... a)
{
//TODO: Use std::invoke() here?
return T_return(this->functor_.template operator() < T_arg... > (std::forward<T_arg>(a)...));
return T_return(std::invoke(this->functor_, std::forward<T_arg>(a)...));
}
retype_return_functor() = default;
@@ -82,8 +81,7 @@ struct retype_return_functor<void, T_functor> : public adapts<T_functor>
template <typename... T_arg>
inline void operator()(T_arg... a)
{
//TODO: Use std::invoke() here?
this->functor_.template operator()<T_arg...>(a...);
std::invoke(this->functor_, a...);
}
retype_return_functor() = default;
@@ -94,9 +94,7 @@ class track_obj_functor : public adapts<T_functor>
template <typename... T_arg>
decltype(auto) operator()(T_arg&&... arg)
{
//TODO: Use std::invoke() here?
return this->functor_.template operator()<type_trait_pass_t<T_arg>...>(
std::forward<T_arg>(arg)...);
return std::invoke(this->functor_, std::forward<T_arg>(arg)...);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS

0 comments on commit 107d097

Please sign in to comment.