Skip to content

Commit 107d097

Browse files
committed
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.
1 parent f3da00b commit 107d097

File tree

5 files changed

+6
-14
lines changed

5 files changed

+6
-14
lines changed

sigc++/adaptors/bind_return.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ struct bind_return_functor : public adapts<T_functor>
4949
template <typename... T_arg>
5050
inline typename unwrap_reference<T_return>::type operator()(T_arg... a)
5151
{
52-
//TODO: Use std::invoke() here?
53-
this->functor_.template operator()<type_trait_pass_t<T_arg>...>(a...);
52+
std::invoke(this->functor_, a...);
5453
return ret_value_.invoke();
5554
}
5655

sigc++/adaptors/exception_catch.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ struct exception_catch_functor : public adapts<T_functor>
9393
{
9494
try
9595
{
96-
//TODO: Use std::invoke here?
97-
return this->functor_.template operator()<type_trait_pass_t<T_arg>...>(a...);
96+
return std::invoke(this->functor_, a...);
9897
}
9998
catch (...)
10099
{

sigc++/adaptors/retype.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ struct retype_functor : public adapts<T_functor>
8282
template <typename... T_arg>
8383
decltype(auto) operator()(T_arg... a)
8484
{
85-
//TODO: Use std::invoke() here?
86-
return this->functor_.template operator()<type_trait_take_t<T_type>...>(
87-
static_cast<T_type>(a)...);
85+
return std::invoke(this->functor_, static_cast<T_type>(a)...);
8886
}
8987

9088
/** Constructs a retype_functor object that performs C-style casts on the parameters passed on to

sigc++/adaptors/retype_return.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ struct retype_return_functor : public adapts<T_functor>
4141
template <typename... T_arg>
4242
inline T_return operator()(T_arg&&... a)
4343
{
44-
//TODO: Use std::invoke() here?
45-
return T_return(this->functor_.template operator() < T_arg... > (std::forward<T_arg>(a)...));
44+
return T_return(std::invoke(this->functor_, std::forward<T_arg>(a)...));
4645
}
4746

4847
retype_return_functor() = default;
@@ -82,8 +81,7 @@ struct retype_return_functor<void, T_functor> : public adapts<T_functor>
8281
template <typename... T_arg>
8382
inline void operator()(T_arg... a)
8483
{
85-
//TODO: Use std::invoke() here?
86-
this->functor_.template operator()<T_arg...>(a...);
84+
std::invoke(this->functor_, a...);
8785
}
8886

8987
retype_return_functor() = default;

sigc++/adaptors/track_obj.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ class track_obj_functor : public adapts<T_functor>
9494
template <typename... T_arg>
9595
decltype(auto) operator()(T_arg&&... arg)
9696
{
97-
//TODO: Use std::invoke() here?
98-
return this->functor_.template operator()<type_trait_pass_t<T_arg>...>(
99-
std::forward<T_arg>(arg)...);
97+
return std::invoke(this->functor_, std::forward<T_arg>(arg)...);
10098
}
10199

102100
#ifndef DOXYGEN_SHOULD_SKIP_THIS

0 commit comments

Comments
 (0)