Skip to content

Commit 783ad82

Browse files
committed
Format source code to suit clang-format
* sigc++/functors/mem_fun.h: * sigc++/functors/ptr_fun.h: * tests/test_rvalue_ref.cc: Reformated with clang-format 13, but CI uses clang-format 10. Also add #include <utility> where std::forward was added. Doesn't seem to be necessary with g++ or clang++. Mostly a precaution.
1 parent cc857ba commit 783ad82

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

sigc++/functors/mem_fun.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <sigc++/limit_reference.h>
2323
#include <sigc++/member_method_trait.h>
2424
#include <functional>
25+
#include <utility>
2526

2627
// implementation notes:
2728
// - we do not use bind here, because it would introduce
@@ -150,8 +151,7 @@ class bound_mem_functor : mem_functor<T_func, T_arg...>
150151
decltype(auto) operator()(type_trait_take_t<T_arg>... a) const
151152
{
152153
return std::invoke(
153-
this->func_ptr_, obj_.invoke(),
154-
std::forward<type_trait_take_t<T_arg>>(a)...);
154+
this->func_ptr_, obj_.invoke(), std::forward<type_trait_take_t<T_arg>>(a)...);
155155
}
156156

157157
// protected:
@@ -187,7 +187,8 @@ struct visitor<bound_mem_functor<T_func, T_arg...>>
187187
* @ingroup mem_fun
188188
*/
189189
template<typename T_return, typename T_obj, typename... T_arg>
190-
inline decltype(auto) mem_fun(T_return (T_obj::*func)(T_arg...))
190+
inline decltype(auto)
191+
mem_fun(T_return (T_obj::*func)(T_arg...))
191192
{
192193
return mem_functor<T_return (T_obj::*)(T_arg...), T_arg...>(func);
193194
}
@@ -212,7 +213,8 @@ mem_fun(T_return (T_obj::*func)(T_arg...) const)
212213
* @ingroup mem_fun
213214
*/
214215
template<typename T_return, typename T_obj, typename... T_arg>
215-
inline decltype(auto) mem_fun(T_return (T_obj::*func)(T_arg...) volatile)
216+
inline decltype(auto)
217+
mem_fun(T_return (T_obj::*func)(T_arg...) volatile)
216218
{
217219
return mem_functor<T_return (T_obj::*)(T_arg...) volatile, T_arg...>(func);
218220
}

sigc++/functors/ptr_fun.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define SIGC_FUNCTORS_PTR_FUN_H
2121
#include <sigc++/type_traits.h>
2222
#include <functional>
23+
#include <utility>
2324

2425
namespace sigc
2526
{
@@ -92,7 +93,8 @@ class pointer_functor<T_return(T_args...)>
9293
* @param a Arguments to be passed on to the function.
9394
* @return The return value of the function invocation.
9495
*/
95-
T_return operator()(type_trait_take_t<T_args>... a) const {
96+
T_return operator()(type_trait_take_t<T_args>... a) const
97+
{
9698
return std::invoke(func_ptr_, std::forward<type_trait_take_t<T_args>>(a)...);
9799
}
98100
};
@@ -104,7 +106,8 @@ class pointer_functor<T_return(T_args...)>
104106
* @ingroup ptr_fun
105107
*/
106108
template<typename T_return, typename... T_args>
107-
inline decltype(auto) ptr_fun(T_return (*func)(T_args...))
109+
inline decltype(auto)
110+
ptr_fun(T_return (*func)(T_args...))
108111
{
109112
return pointer_functor<T_return(T_args...)>(func);
110113
}

tests/test_rvalue_ref.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ struct foo
1818

1919
struct A
2020
{
21-
void foo(MoveableStruct &&) { result_stream << "A::foo(MoveableStruct&&)"; }
21+
void foo(MoveableStruct&&) { result_stream << "A::foo(MoveableStruct&&)"; }
2222
};
2323

24-
void boo(MoveableStruct &&) {
24+
void
25+
boo(MoveableStruct&&)
26+
{
2527
result_stream << "boo(MoveableStruct&&)";
2628
}
2729

@@ -52,7 +54,7 @@ test_slot()
5254
void
5355
test_mem_fun()
5456
{
55-
sigc::slot<void(A &, MoveableStruct &&)> slot;
57+
sigc::slot<void(A&, MoveableStruct &&)> slot;
5658
A a;
5759
slot = sigc::mem_fun(&A::foo);
5860
MoveableStruct x;

0 commit comments

Comments
 (0)