summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2021-12-23 12:51:38 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2021-12-23 12:51:38 +0100
commit783ad8239c03fbb44b3ed2c28282a43f849adafa (patch)
tree2ec9c20bbd91a270b525aa1acbb3683f6ad27c53
parentcc857baa5aac41f5731e92d2da276826481a4631 (diff)
downloadsigc++-783ad8239c03fbb44b3ed2c28282a43f849adafa.tar.gz
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.
-rw-r--r--sigc++/functors/mem_fun.h10
-rw-r--r--sigc++/functors/ptr_fun.h7
-rw-r--r--tests/test_rvalue_ref.cc8
3 files changed, 16 insertions, 9 deletions
diff --git a/sigc++/functors/mem_fun.h b/sigc++/functors/mem_fun.h
index 1b74c3d..1ebccbb 100644
--- a/sigc++/functors/mem_fun.h
+++ b/sigc++/functors/mem_fun.h
@@ -22,6 +22,7 @@
#include <sigc++/limit_reference.h>
#include <sigc++/member_method_trait.h>
#include <functional>
+#include <utility>
// implementation notes:
// - we do not use bind here, because it would introduce
@@ -150,8 +151,7 @@ public:
decltype(auto) operator()(type_trait_take_t<T_arg>... a) const
{
return std::invoke(
- this->func_ptr_, obj_.invoke(),
- std::forward<type_trait_take_t<T_arg>>(a)...);
+ this->func_ptr_, obj_.invoke(), std::forward<type_trait_take_t<T_arg>>(a)...);
}
// protected:
@@ -187,7 +187,8 @@ struct visitor<bound_mem_functor<T_func, T_arg...>>
* @ingroup mem_fun
*/
template<typename T_return, typename T_obj, typename... T_arg>
-inline decltype(auto) mem_fun(T_return (T_obj::*func)(T_arg...))
+inline decltype(auto)
+mem_fun(T_return (T_obj::*func)(T_arg...))
{
return mem_functor<T_return (T_obj::*)(T_arg...), T_arg...>(func);
}
@@ -212,7 +213,8 @@ mem_fun(T_return (T_obj::*func)(T_arg...) const)
* @ingroup mem_fun
*/
template<typename T_return, typename T_obj, typename... T_arg>
-inline decltype(auto) mem_fun(T_return (T_obj::*func)(T_arg...) volatile)
+inline decltype(auto)
+mem_fun(T_return (T_obj::*func)(T_arg...) volatile)
{
return mem_functor<T_return (T_obj::*)(T_arg...) volatile, T_arg...>(func);
}
diff --git a/sigc++/functors/ptr_fun.h b/sigc++/functors/ptr_fun.h
index c1dc8b7..b80ccab 100644
--- a/sigc++/functors/ptr_fun.h
+++ b/sigc++/functors/ptr_fun.h
@@ -20,6 +20,7 @@
#define SIGC_FUNCTORS_PTR_FUN_H
#include <sigc++/type_traits.h>
#include <functional>
+#include <utility>
namespace sigc
{
@@ -92,7 +93,8 @@ public:
* @param a Arguments to be passed on to the function.
* @return The return value of the function invocation.
*/
- T_return operator()(type_trait_take_t<T_args>... a) const {
+ T_return operator()(type_trait_take_t<T_args>... a) const
+ {
return std::invoke(func_ptr_, std::forward<type_trait_take_t<T_args>>(a)...);
}
};
@@ -104,7 +106,8 @@ public:
* @ingroup ptr_fun
*/
template<typename T_return, typename... T_args>
-inline decltype(auto) ptr_fun(T_return (*func)(T_args...))
+inline decltype(auto)
+ptr_fun(T_return (*func)(T_args...))
{
return pointer_functor<T_return(T_args...)>(func);
}
diff --git a/tests/test_rvalue_ref.cc b/tests/test_rvalue_ref.cc
index 4e1666b..344a856 100644
--- a/tests/test_rvalue_ref.cc
+++ b/tests/test_rvalue_ref.cc
@@ -18,10 +18,12 @@ struct foo
struct A
{
- void foo(MoveableStruct &&) { result_stream << "A::foo(MoveableStruct&&)"; }
+ void foo(MoveableStruct&&) { result_stream << "A::foo(MoveableStruct&&)"; }
};
-void boo(MoveableStruct &&) {
+void
+boo(MoveableStruct&&)
+{
result_stream << "boo(MoveableStruct&&)";
}
@@ -52,7 +54,7 @@ test_slot()
void
test_mem_fun()
{
- sigc::slot<void(A &, MoveableStruct &&)> slot;
+ sigc::slot<void(A&, MoveableStruct &&)> slot;
A a;
slot = sigc::mem_fun(&A::foo);
MoveableStruct x;