File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ class mem_functor
113
113
*/
114
114
decltype (auto ) operator ()(obj_type_with_modifier& obj, type_trait_take_t <T_arg>... a) const
115
115
{
116
- return std::invoke (func_ptr_, obj, a ...);
116
+ return std::invoke (func_ptr_, obj, std::forward< type_trait_take_t <T_arg>>(a) ...);
117
117
}
118
118
119
119
protected:
Original file line number Diff line number Diff line change @@ -92,7 +92,9 @@ class pointer_functor<T_return(T_args...)>
92
92
* @param a Arguments to be passed on to the function.
93
93
* @return The return value of the function invocation.
94
94
*/
95
- T_return operator ()(type_trait_take_t <T_args>... a) const { return std::invoke (func_ptr_, a...); }
95
+ T_return operator ()(type_trait_take_t <T_args>... a) const {
96
+ return std::invoke (func_ptr_, std::forward<type_trait_take_t <T_args>>(a)...);
97
+ }
96
98
};
97
99
98
100
/* * Creates a functor of type sigc::pointer_functor which wraps an existing non-member function.
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ struct A
21
21
void foo (MoveableStruct &&) { result_stream << " A::foo(MoveableStruct&&)" ; }
22
22
};
23
23
24
+ void boo (MoveableStruct &&) {
25
+ result_stream << " boo(MoveableStruct&&)" ;
26
+ }
24
27
25
28
} // end anonymous namespace
26
29
@@ -48,6 +51,17 @@ test_slot()
48
51
49
52
void
50
53
test_mem_fun ()
54
+ {
55
+ sigc::slot<void (A &, MoveableStruct &&)> slot;
56
+ A a;
57
+ slot = sigc::mem_fun (&A::foo);
58
+ MoveableStruct x;
59
+ slot (a, std::move (x));
60
+ util->check_result (result_stream, " A::foo(MoveableStruct&&)" );
61
+ }
62
+
63
+ void
64
+ test_bound_mem_fun ()
51
65
{
52
66
sigc::slot<void (MoveableStruct &&)> slot;
53
67
A a;
@@ -57,6 +71,16 @@ test_mem_fun()
57
71
util->check_result (result_stream, " A::foo(MoveableStruct&&)" );
58
72
}
59
73
74
+ void
75
+ test_ptr_fun ()
76
+ {
77
+ sigc::slot<void (MoveableStruct &&)> slot;
78
+ slot = sigc::ptr_fun (&boo);
79
+ MoveableStruct x;
80
+ slot (std::move (x));
81
+ util->check_result (result_stream, " boo(MoveableStruct&&)" );
82
+ }
83
+
60
84
int
61
85
main (int argc, char * argv[])
62
86
{
@@ -66,7 +90,9 @@ main(int argc, char* argv[])
66
90
67
91
test_signal ();
68
92
test_slot ();
93
+ test_bound_mem_fun ();
69
94
test_mem_fun ();
95
+ test_ptr_fun ();
70
96
71
97
return util->get_result_and_delete_instance () ? EXIT_SUCCESS : EXIT_FAILURE;
72
98
} // end main()
You can’t perform that action at this time.
0 commit comments