summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2019-10-28 12:16:22 +0100
committerMurray Cumming <murrayc@murrayc.com>2019-10-28 12:26:02 +0100
commit294ce7177c5315e2ada29acd184900dcda4289c8 (patch)
treec114ef20e9689f8dedcedc700a66f0936a69ba3c
parent8d747d775ae9da0a7703d28333dc326d81b36120 (diff)
downloadsigc++-294ce7177c5315e2ada29acd184900dcda4289c8.tar.gz
Reformat code with make format
-rw-r--r--sigc++/adaptors/adaptor_trait.h17
-rw-r--r--sigc++/adaptors/adapts.h2
-rw-r--r--sigc++/adaptors/bind.h30
-rw-r--r--sigc++/adaptors/bind_return.h19
-rw-r--r--sigc++/adaptors/bound_argument.h20
-rw-r--r--sigc++/adaptors/compose.h31
-rw-r--r--sigc++/adaptors/exception_catch.h10
-rw-r--r--sigc++/adaptors/hide.h16
-rw-r--r--sigc++/adaptors/retype.h24
-rw-r--r--sigc++/adaptors/retype_return.h23
-rw-r--r--sigc++/adaptors/track_obj.h16
-rw-r--r--sigc++/adaptors/tuple_visitor_visit_each.h4
-rw-r--r--sigc++/connection.cc19
-rw-r--r--sigc++/functors/functor_trait.h8
-rw-r--r--sigc++/functors/mem_fun.h52
-rw-r--r--sigc++/functors/ptr_fun.h11
-rw-r--r--sigc++/functors/slot.h39
-rw-r--r--sigc++/functors/slot_base.cc8
-rw-r--r--sigc++/functors/slot_base.h9
-rw-r--r--sigc++/limit_reference.h8
-rw-r--r--sigc++/member_method_trait.h40
-rw-r--r--sigc++/reference_wrapper.h10
-rw-r--r--sigc++/signal.h39
-rw-r--r--sigc++/signal_base.cc20
-rw-r--r--sigc++/signal_base.h11
-rw-r--r--sigc++/trackable.cc11
-rw-r--r--sigc++/tuple-utils/tuple_cdr.h27
-rw-r--r--sigc++/tuple-utils/tuple_end.h53
-rw-r--r--sigc++/tuple-utils/tuple_for_each.h18
-rw-r--r--sigc++/tuple-utils/tuple_start.h48
-rw-r--r--sigc++/tuple-utils/tuple_transform_each.h69
-rw-r--r--sigc++/type_traits.h14
-rw-r--r--sigc++/visit_each.h29
-rw-r--r--sigc++/weak_raw_ptr.h36
-rw-r--r--tests/benchmark.cc39
-rw-r--r--tests/test_accum_iter.cc7
-rw-r--r--tests/test_accumulated.cc6
-rw-r--r--tests/test_bind.cc4
-rw-r--r--tests/test_bind_refptr.cc66
-rw-r--r--tests/test_cpp11_lambda.cc24
-rw-r--r--tests/test_disconnect.cc2
-rw-r--r--tests/test_limit_reference.cc4
-rw-r--r--tests/test_mem_fun.cc40
-rw-r--r--tests/test_signal.cc5
-rw-r--r--tests/test_size.cc37
-rw-r--r--tests/test_track_obj.cc1
-rw-r--r--tests/test_trackable_move.cc4
-rw-r--r--tests/test_tuple_for_each.cc20
-rw-r--r--tests/test_tuple_transform_each.cc22
-rw-r--r--tests/test_visit_each.cc22
-rw-r--r--tests/test_visit_each_trackable.cc14
-rw-r--r--tests/test_weak_raw_ptr.cc27
-rw-r--r--tests/testutilities.cc4
53 files changed, 566 insertions, 573 deletions
diff --git a/sigc++/adaptors/adaptor_trait.h b/sigc++/adaptors/adaptor_trait.h
index fe7f3e7..34ef401 100644
--- a/sigc++/adaptors/adaptor_trait.h
+++ b/sigc++/adaptors/adaptor_trait.h
@@ -82,7 +82,7 @@ namespace sigc
*
* @ingroup adaptors
*/
-template <typename T_functor>
+template<typename T_functor>
struct adaptor_functor : public adaptor_base
{
/** Invokes the wrapped functor passing on the arguments.
@@ -94,7 +94,7 @@ struct adaptor_functor : public adaptor_base
* @param arg Arguments to be passed on to the functor.
* @return The return value of the functor invocation.
*/
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg&&... arg) const
{
return std::invoke(functor_, std::forward<T_arg>(arg)...);
@@ -112,7 +112,7 @@ struct adaptor_functor : public adaptor_base
* function pointer.
* @param type Pointer to function or class method to invoke from operator()().
*/
- template <typename T_type>
+ template<typename T_type>
explicit adaptor_functor(const T_type& type) : functor_(type)
{
}
@@ -129,10 +129,10 @@ struct adaptor_functor : public adaptor_base
*
* @ingroup adaptors
*/
-template <typename T_functor>
+template<typename T_functor>
struct visitor<adaptor_functor<T_functor>>
{
- template <typename T_action>
+ template<typename T_action>
static void do_visit_each(const T_action& action, const adaptor_functor<T_functor>& target)
{
sigc::visit_each(action, target.functor_);
@@ -149,15 +149,14 @@ struct visitor<adaptor_functor<T_functor>>
*
* @ingroup adaptors
*/
-template <typename T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_functor>::value>
+template<typename T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_functor>::value>
struct adaptor_trait;
-
/** Trait that specifies the adaptor version of a functor type.
* This template specialization is used for types that inherit from adaptor_base.
* adaptor_type is equal to @p T_functor in this case.
*/
-template <typename T_functor>
+template<typename T_functor>
struct adaptor_trait<T_functor, true>
{
using adaptor_type = T_functor;
@@ -169,7 +168,7 @@ struct adaptor_trait<T_functor, true>
* The latter are converted into @p pointer_functor or @p mem_functor types.
* adaptor_type is equal to @p adaptor_functor<functor_type>.
*/
-template <typename T_functor>
+template<typename T_functor>
struct adaptor_trait<T_functor, false>
{
private:
diff --git a/sigc++/adaptors/adapts.h b/sigc++/adaptors/adapts.h
index 959f152..08ae002 100644
--- a/sigc++/adaptors/adapts.h
+++ b/sigc++/adaptors/adapts.h
@@ -91,7 +91,7 @@ namespace sigc
*
* @ingroup adaptors
*/
-template <typename T_functor>
+template<typename T_functor>
struct adapts : public adaptor_base
{
private:
diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h
index 7c187d1..1d89ba0 100644
--- a/sigc++/adaptors/bind.h
+++ b/sigc++/adaptors/bind.h
@@ -102,7 +102,7 @@ namespace sigc
namespace internal
{
-template <typename T_element>
+template<typename T_element>
struct TransformEachInvoker
{
// We take T_element as non-const because invoke() is not const.
@@ -122,7 +122,7 @@ struct TransformEachInvoker
*
* @ingroup bind
*/
-template <int I_location, typename T_functor, typename... T_bound>
+template<int I_location, typename T_functor, typename... T_bound>
struct bind_functor : public adapts<T_functor>
{
/** Invokes the wrapped functor passing on the arguments.
@@ -130,7 +130,7 @@ struct bind_functor : public adapts<T_functor>
* @param arg Arguments to be passed on to the functor.
* @return The return value of the functor invocation.
*/
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg&&... arg)
{
// For instance, if I_location is 1, and arg has 4 arguments,
@@ -171,7 +171,7 @@ struct bind_functor : public adapts<T_functor>
*
* @ingroup bind
*/
-template <typename T_functor, typename... T_type>
+template<typename T_functor, typename... T_type>
struct bind_functor<-1, T_functor, T_type...> : public adapts<T_functor>
{
public:
@@ -180,7 +180,7 @@ public:
* @param arg Arguments to be passed on to the functor.
* @return The return value of the functor invocation.
*/
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg&&... arg)
{
// For instance, if arg has 4 arguments,
@@ -215,12 +215,12 @@ public:
*
* @ingroup bind
*/
-template <int T_loc, typename T_functor, typename... T_bound>
+template<int T_loc, typename T_functor, typename... T_bound>
struct visitor<bind_functor<T_loc, T_functor, T_bound...>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const bind_functor<T_loc, T_functor, T_bound...>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const bind_functor<T_loc, T_functor, T_bound...>& target)
{
sigc::visit_each(action, target.functor_);
sigc::visit_each(action, std::get<0>(target.bound_));
@@ -234,12 +234,12 @@ struct visitor<bind_functor<T_loc, T_functor, T_bound...>>
*
* @ingroup bind
*/
-template <typename T_functor, typename... T_type>
+template<typename T_functor, typename... T_type>
struct visitor<bind_functor<-1, T_functor, T_type...>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const bind_functor<-1, T_functor, T_type...>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const bind_functor<-1, T_functor, T_type...>& target)
{
sigc::visit_each(action, target.functor_);
@@ -260,7 +260,7 @@ struct visitor<bind_functor<-1, T_functor, T_type...>>
*
* @ingroup bind
*/
-template <int I_location, typename T_functor, typename... T_bound>
+template<int I_location, typename T_functor, typename... T_bound>
inline decltype(auto)
bind(const T_functor& func, T_bound... b)
{
@@ -277,7 +277,7 @@ bind(const T_functor& func, T_bound... b)
*
* @ingroup bind
*/
-template <typename T_functor, typename... T_type>
+template<typename T_functor, typename... T_type>
inline decltype(auto)
bind(const T_functor& func, T_type... b)
{
diff --git a/sigc++/adaptors/bind_return.h b/sigc++/adaptors/bind_return.h
index cb5a26a..b02f936 100644
--- a/sigc++/adaptors/bind_return.h
+++ b/sigc++/adaptors/bind_return.h
@@ -34,7 +34,7 @@ namespace sigc
*
* @ingroup bind
*/
-template <typename T_return, typename T_functor>
+template<typename T_return, typename T_functor>
struct bind_return_functor : public adapts<T_functor>
{
/** Invokes the wrapped functor dropping its return value.
@@ -46,7 +46,7 @@ struct bind_return_functor : public adapts<T_functor>
* @param a Arguments to be passed on to the functor.
* @return The fixed return value.
*/
- template <typename... T_arg>
+ template<typename... T_arg>
inline typename unwrap_reference<T_return>::type operator()(T_arg... a)
{
std::invoke(this->functor_, a...);
@@ -57,8 +57,7 @@ struct bind_return_functor : public adapts<T_functor>
* @param functor Functor to invoke from operator()().
* @param ret_value Value to return from operator()().
*/
- bind_return_functor(
- type_trait_take_t<T_functor> functor, type_trait_take_t<T_return> ret_value)
+ bind_return_functor(type_trait_take_t<T_functor> functor, type_trait_take_t<T_return> ret_value)
: adapts<T_functor>(functor), ret_value_(ret_value)
{
}
@@ -67,7 +66,7 @@ struct bind_return_functor : public adapts<T_functor>
bound_argument<T_return> ret_value_; // public, so that visit_each() can access it
};
-template <typename T_return, typename T_functor>
+template<typename T_return, typename T_functor>
typename unwrap_reference<T_return>::type
bind_return_functor<T_return, T_functor>::operator()()
{
@@ -83,12 +82,12 @@ bind_return_functor<T_return, T_functor>::operator()()
*
* @ingroup bind
*/
-template <typename T_return, typename T_functor>
+template<typename T_return, typename T_functor>
struct visitor<bind_return_functor<T_return, T_functor>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const bind_return_functor<T_return, T_functor>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const bind_return_functor<T_return, T_functor>& target)
{
sigc::visit_each(action, target.ret_value_);
sigc::visit_each(action, target.functor_);
@@ -105,7 +104,7 @@ struct visitor<bind_return_functor<T_return, T_functor>>
*
* @ingroup bind
*/
-template <typename T_return, typename T_functor>
+template<typename T_return, typename T_functor>
inline bind_return_functor<T_return, T_functor>
bind_return(const T_functor& functor, T_return ret_value)
{
diff --git a/sigc++/adaptors/bound_argument.h b/sigc++/adaptors/bound_argument.h
index a0ca6da..c9899df 100644
--- a/sigc++/adaptors/bound_argument.h
+++ b/sigc++/adaptors/bound_argument.h
@@ -46,7 +46,7 @@ namespace sigc
* The general template implementation is used for parameters that are passed by value.
* @e T_type The type of the bound argument.
*/
-template <typename T_type>
+template<typename T_type>
class bound_argument
{
public:
@@ -76,17 +76,14 @@ private:
* returned by bind_return() by reference, specialized for std::reference_wrapper<> types.
* @e T_wrapped The type of the bound argument.
*/
-template <typename T_wrapped>
+template<typename T_wrapped>
class bound_argument<std::reference_wrapper<T_wrapped>>
{
public:
/** Constructor.
* @param arg The argument to bind.
*/
- bound_argument(const std::reference_wrapper<T_wrapped>& arg)
- : visited_(unwrap(arg))
- {
- }
+ bound_argument(const std::reference_wrapper<T_wrapped>& arg) : visited_(unwrap(arg)) {}
/** Retrieve the entity to visit in visit_each().
* @return The limited_reference to the bound argument.
@@ -108,17 +105,14 @@ private:
* returned by bind_return() by const reference, specialized for const reference_wrapper<> types.
* - @e T_wrapped The type of the bound argument.
*/
-template <typename T_wrapped>
+template<typename T_wrapped>
class bound_argument<std::reference_wrapper<const T_wrapped>>
{
public:
/** Constructor.
* @param arg The argument to bind.
*/
- bound_argument(const std::reference_wrapper<const T_wrapped>& arg)
- : visited_(unwrap(arg))
- {
- }
+ bound_argument(const std::reference_wrapper<const T_wrapped>& arg) : visited_(unwrap(arg)) {}
/** Retrieve the entity to visit in visit_each().
* @return The const_limited_reference to the bound argument.
@@ -145,10 +139,10 @@ private:
* @param action The functor to invoke.
* @param arg The visited instance.
*/
-template <typename T_type>
+template<typename T_type>
struct visitor<bound_argument<T_type>>
{
- template <typename T_action>
+ template<typename T_action>
static void do_visit_each(const T_action& action, const bound_argument<T_type>& arg)
{
sigc::visit_each(action, arg.visit());
diff --git a/sigc++/adaptors/compose.h b/sigc++/adaptors/compose.h
index 5a3616f..3fadceb 100644
--- a/sigc++/adaptors/compose.h
+++ b/sigc++/adaptors/compose.h
@@ -59,10 +59,10 @@ namespace sigc
*
* @ingroup compose
*/
-template <typename T_setter, typename T_getter>
+template<typename T_setter, typename T_getter>
struct compose1_functor : public adapts<T_setter>
{
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg&&... a)
{
return std::invoke(this->functor_, get_(std::forward<T_arg>(a)...));
@@ -91,10 +91,10 @@ struct compose1_functor : public adapts<T_setter>
*
* @ingroup compose
*/
-template <typename T_setter, typename T_getter1, typename T_getter2>
+template<typename T_setter, typename T_getter1, typename T_getter2>
struct compose2_functor : public adapts<T_setter>
{
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg... a)
{
return std::invoke(this->functor_, get1_(a...), get2_(a...));
@@ -106,8 +106,7 @@ struct compose2_functor : public adapts<T_setter>
* @param getter1 Functor to invoke from operator()().
* @param getter2 Functor to invoke from operator()().
*/
- compose2_functor(
- const T_setter& setter, const T_getter1& getter1, const T_getter2& getter2)
+ compose2_functor(const T_setter& setter, const T_getter1& getter1, const T_getter2& getter2)
: adapts<T_setter>(setter), get1_(getter1), get2_(getter2)
{
}
@@ -124,12 +123,12 @@ struct compose2_functor : public adapts<T_setter>
*
* @ingroup compose
*/
-template <typename T_setter, typename T_getter>
+template<typename T_setter, typename T_getter>
struct visitor<compose1_functor<T_setter, T_getter>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const compose1_functor<T_setter, T_getter>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const compose1_functor<T_setter, T_getter>& target)
{
sigc::visit_each(action, target.functor_);
sigc::visit_each(action, target.get_);
@@ -143,12 +142,12 @@ struct visitor<compose1_functor<T_setter, T_getter>>
*
* @ingroup compose
*/
-template <typename T_setter, typename T_getter1, typename T_getter2>
+template<typename T_setter, typename T_getter1, typename T_getter2>
struct visitor<compose2_functor<T_setter, T_getter1, T_getter2>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const compose2_functor<T_setter, T_getter1, T_getter2>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const compose2_functor<T_setter, T_getter1, T_getter2>& target)
{
sigc::visit_each(action, target.functor_);
sigc::visit_each(action, target.get1_);
@@ -166,7 +165,7 @@ struct visitor<compose2_functor<T_setter, T_getter1, T_getter2>>
*
* @ingroup compose
*/
-template <typename T_setter, typename T_getter>
+template<typename T_setter, typename T_getter>
inline compose1_functor<T_setter, T_getter>
compose(const T_setter& setter, const T_getter& getter)
{
@@ -184,7 +183,7 @@ compose(const T_setter& setter, const T_getter& getter)
*
* @ingroup compose
*/
-template <typename T_setter, typename T_getter1, typename T_getter2>
+template<typename T_setter, typename T_getter1, typename T_getter2>
inline compose2_functor<T_setter, T_getter1, T_getter2>
compose(const T_setter& setter, const T_getter1& getter1, const T_getter2& getter2)
{
diff --git a/sigc++/adaptors/exception_catch.h b/sigc++/adaptors/exception_catch.h
index ed60d0c..a7ccf9a 100644
--- a/sigc++/adaptors/exception_catch.h
+++ b/sigc++/adaptors/exception_catch.h
@@ -73,7 +73,7 @@ namespace sigc
* @ingroup adaptors
*/
-template <typename T_functor, typename T_catcher>
+template<typename T_functor, typename T_catcher>
struct exception_catch_functor : public adapts<T_functor>
{
decltype(auto) operator()()
@@ -88,7 +88,7 @@ struct exception_catch_functor : public adapts<T_functor>
}
}
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg... a)
{
try
@@ -111,10 +111,10 @@ struct exception_catch_functor : public adapts<T_functor>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// template specialization of visitor<>::do_visit_each<>(action, functor):
-template <typename T_functor, typename T_catcher>
+template<typename T_functor, typename T_catcher>
struct visitor<exception_catch_functor<T_functor, T_catcher>>
{
- template <typename T_action>
+ template<typename T_action>
static void do_visit_each(const T_action& action,
const exception_catch_functor<T_functor, T_catcher>& target)
{
@@ -124,7 +124,7 @@ struct visitor<exception_catch_functor<T_functor, T_catcher>>
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
-template <typename T_functor, typename T_catcher>
+template<typename T_functor, typename T_catcher>
inline decltype(auto)
exception_catch(const T_functor& func, const T_catcher& catcher)
{
diff --git a/sigc++/adaptors/hide.h b/sigc++/adaptors/hide.h
index 8d9d145..ac8a1a0 100644
--- a/sigc++/adaptors/hide.h
+++ b/sigc++/adaptors/hide.h
@@ -84,14 +84,14 @@ namespace sigc
*
* @ingroup hide
*/
-template <int I_location, typename T_functor>
+template<int I_location, typename T_functor>
struct hide_functor : public adapts<T_functor>
{
/** Invokes the wrapped functor, ignoring the argument at index @e I_location (0-indexed).
* @param a Arguments to be passed on to the functor, apart from the ignored argument.
* @return The return value of the functor invocation.
*/
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg&&... a)
{
constexpr auto size = sizeof...(T_arg);
@@ -119,12 +119,12 @@ struct hide_functor : public adapts<T_functor>
*
* @ingroup hide
*/
-template <int I_location, typename T_functor>
+template<int I_location, typename T_functor>
struct visitor<hide_functor<I_location, T_functor>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const hide_functor<I_location, T_functor>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const hide_functor<I_location, T_functor>& target)
{
sigc::visit_each(action, target.functor_);
}
@@ -141,7 +141,7 @@ struct visitor<hide_functor<I_location, T_functor>>
*
* @ingroup hide
*/
-template <int I_location, typename T_functor>
+template<int I_location, typename T_functor>
inline decltype(auto)
hide(const T_functor& func)
{
@@ -157,7 +157,7 @@ hide(const T_functor& func)
*
* @ingroup hide
*/
-template <typename T_functor>
+template<typename T_functor>
inline decltype(auto)
hide(const T_functor& func)
{
diff --git a/sigc++/adaptors/retype.h b/sigc++/adaptors/retype.h
index a628f95..948fe5c 100644
--- a/sigc++/adaptors/retype.h
+++ b/sigc++/adaptors/retype.h
@@ -76,10 +76,10 @@ namespace sigc
*
* @ingroup retype
*/
-template <typename T_functor, typename... T_type>
+template<typename T_functor, typename... T_type>
struct retype_functor : public adapts<T_functor>
{
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg... a)
{
return std::invoke(this->functor_, static_cast<T_type>(a)...);
@@ -89,9 +89,7 @@ struct retype_functor : public adapts<T_functor>
* the functor.
* @param functor Functor to invoke from operator()().
*/
- explicit retype_functor(type_trait_take_t<T_functor> functor) : adapts<T_functor>(functor)
- {
- }
+ explicit retype_functor(type_trait_take_t<T_functor> functor) : adapts<T_functor>(functor) {}
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -102,12 +100,12 @@ struct retype_functor : public adapts<T_functor>
*
* @ingroup retype
*/
-template <typename T_functor, typename... T_type>
+template<typename T_functor, typename... T_type>
struct visitor<retype_functor<T_functor, T_type...>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const retype_functor<T_functor, T_type...>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const retype_functor<T_functor, T_type...>& target)
{
sigc::visit_each(action, target.functor_);
}
@@ -123,7 +121,9 @@ struct visitor<retype_functor<T_functor, T_type...>>
*
* @ingroup retype
*/
-template <template <typename T_func, typename... T_arg> class T_functor, typename T_func, typename... T_arg>
+template<template<typename T_func, typename... T_arg> class T_functor,
+ typename T_func,
+ typename... T_arg>
inline decltype(auto)
retype(const T_functor<T_func, T_arg...>& functor)
{
@@ -139,7 +139,9 @@ retype(const T_functor<T_func, T_arg...>& functor)
*
* @ingroup retype
*/
-template <template <typename T_return, typename... T_arg> class T_functor, typename T_return, typename... T_arg>
+template<template<typename T_return, typename... T_arg> class T_functor,
+ typename T_return,
+ typename... T_arg>
inline decltype(auto)
retype(const T_functor<T_return(T_arg...)>& functor)
{
diff --git a/sigc++/adaptors/retype_return.h b/sigc++/adaptors/retype_return.h
index 57959f9..e3911b8 100644
--- a/sigc++/adaptors/retype_return.h
+++ b/sigc++/adaptors/retype_return.h
@@ -33,10 +33,10 @@ namespace sigc
*
* @ingroup retype
*/
-template <typename T_return, typename T_functor>
+template<typename T_return, typename T_functor>
struct retype_return_functor : public adapts<T_functor>
{
- template <typename... T_arg>
+ template<typename... T_arg>
inline T_return operator()(T_arg&&... a)
{
return T_return(std::invoke(this->functor_, std::forward<T_arg>(a)...));
@@ -48,8 +48,7 @@ struct retype_return_functor : public adapts<T_functor>
* the passed functor.
* @param functor Functor to invoke from operator()().
*/
- explicit retype_return_functor(type_trait_take_t<T_functor> functor)
- : adapts<T_functor>(functor)
+ explicit retype_return_functor(type_trait_take_t<T_functor> functor) : adapts<T_functor>(functor)
{
}
};
@@ -64,10 +63,10 @@ struct retype_return_functor : public adapts<T_functor>
*/
/* The void specialization is needed because of explicit cast to T_return.
*/
-template <typename T_functor>
+template<typename T_functor>
struct retype_return_functor<void, T_functor> : public adapts<T_functor>
{
- template <typename... T_arg>
+ template<typename... T_arg>
inline void operator()(T_arg... a)
{
std::invoke(this->functor_, a...);
@@ -85,12 +84,12 @@ struct retype_return_functor<void, T_functor> : public adapts<T_functor>
*
* @ingroup retype
*/
-template <typename T_return, typename T_functor>
+template<typename T_return, typename T_functor>
struct visitor<retype_return_functor<T_return, T_functor>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const retype_return_functor<T_return, T_functor>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const retype_return_functor<T_return, T_functor>& target)
{
sigc::visit_each(action, target.functor_);
}
@@ -106,7 +105,7 @@ struct visitor<retype_return_functor<T_return, T_functor>>
*
* @ingroup retype
*/
-template <typename T_return, typename T_functor>
+template<typename T_return, typename T_functor>
inline retype_return_functor<T_return, T_functor>
retype_return(const T_functor& functor)
{
@@ -121,7 +120,7 @@ retype_return(const T_functor& functor)
*
* @ingroup hide
*/
-template <typename T_functor>
+template<typename T_functor>
inline retype_return_functor<void, T_functor>
hide_return(const T_functor& functor)
{
diff --git a/sigc++/adaptors/track_obj.h b/sigc++/adaptors/track_obj.h
index d894781..6f208f3 100644
--- a/sigc++/adaptors/track_obj.h
+++ b/sigc++/adaptors/track_obj.h
@@ -65,7 +65,7 @@ namespace sigc
*
* @ingroup track_obj
*/
-template <typename T_functor, typename... T_obj>
+template<typename T_functor, typename... T_obj>
class track_obj_functor : public adapts<T_functor>
{
public:
@@ -83,7 +83,7 @@ public:
* @param arg Arguments to be passed on to the functor.
* @return The return value of the functor invocation.
*/
- template <typename... T_arg>
+ template<typename... T_arg>
decltype(auto) operator()(T_arg&&... arg)
{
return std::invoke(this->functor_, std::forward<T_arg>(arg)...);
@@ -108,17 +108,17 @@ public:
*
* @ingroup track_obj
*/
-template <typename T_functor, typename... T_obj>
+template<typename T_functor, typename... T_obj>
struct visitor<track_obj_functor<T_functor, T_obj...>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const track_obj_functor<T_functor, T_obj...>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const track_obj_functor<T_functor, T_obj...>& target)
{
sigc::visit_each(action, target.functor_);
// Call sigc::visit_each(action, element) on each element in the
- //target.obj_ tuple:
+ // target.obj_ tuple:
sigc::internal::tuple_for_each<internal::TupleVisitorVisitEach>(target.obj_, action);
}
};
@@ -133,7 +133,7 @@ struct visitor<track_obj_functor<T_functor, T_obj...>>
*
* @ingroup track_obj
*/
-template <typename T_functor, typename... T_obj>
+template<typename T_functor, typename... T_obj>
inline decltype(auto)
track_obj(const T_functor& func, const T_obj&... obj)
{
diff --git a/sigc++/adaptors/tuple_visitor_visit_each.h b/sigc++/adaptors/tuple_visitor_visit_each.h
index 5cccd49..60f977e 100644
--- a/sigc++/adaptors/tuple_visitor_visit_each.h
+++ b/sigc++/adaptors/tuple_visitor_visit_each.h
@@ -29,10 +29,10 @@ namespace internal
{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-template <typename T_element>
+template<typename T_element>
struct TupleVisitorVisitEach
{
- template <typename T_action>
+ template<typename T_action>
constexpr static void visit(const T_element& element, T_action&& action)
{
sigc::visit_each(std::forward<T_action>(action), element);
diff --git a/sigc++/connection.cc b/sigc++/connection.cc
index f70a9ba..0f9318d 100644
--- a/sigc++/connection.cc
+++ b/sigc++/connection.cc
@@ -22,19 +22,11 @@
namespace sigc
{
-connection::connection() noexcept : slot_(nullptr)
-{
-}
-
-connection::connection(slot_base& slot)
-: slot_(&slot)
-{
-}
+connection::connection() noexcept : slot_(nullptr) {}
+connection::connection(slot_base& slot) : slot_(&slot) {}
-connection::connection(const connection& c) : slot_(c.slot_)
-{
-}
+connection::connection(const connection& c) : slot_(c.slot_) {}
connection&
connection::operator=(const connection& src)
@@ -43,9 +35,7 @@ connection::operator=(const connection& src)
return *this;
}
-connection::~connection()
-{
-}
+connection::~connection() {}
bool
connection::empty() const noexcept
@@ -95,5 +85,4 @@ connection::set_slot(const sigc::internal::weak_raw_ptr<slot_base>& sl)
slot_ = sl;
}
-
} /* namespace sigc */
diff --git a/sigc++/functors/functor_trait.h b/sigc++/functors/functor_trait.h
index d50c457..61e5c68 100644
--- a/sigc++/functors/functor_trait.h
+++ b/sigc++/functors/functor_trait.h
@@ -54,7 +54,7 @@ namespace sigc
*
* @ingroup sigcfunctors
*/
-template <typename T_functor>
+template<typename T_functor>
struct functor_trait
{
using functor_type = T_functor;
@@ -65,7 +65,7 @@ struct functor_trait
// functor ptr fun:
-template <typename T_return, typename... T_arg>
+template<typename T_return, typename... T_arg>
struct functor_trait<T_return (*)(T_arg...)>
{
using functor_type = pointer_functor<T_return(T_arg...)>;
@@ -73,13 +73,13 @@ struct functor_trait<T_return (*)(T_arg...)>
// functor mem fun:
-template <typename T_return, typename T_obj, typename... T_arg>
+template<typename T_return, typename T_obj, typename... T_arg>
struct functor_trait<T_return (T_obj::*)(T_arg...)>
{
using functor_type = mem_functor<T_return (T_obj::*)(T_arg...), T_arg...>;
};
-template <typename T_return, typename T_obj, typename... T_arg>
+template<typename T_return, typename T_obj, typename... T_arg>
struct functor_trait<T_return (T_obj::*)(T_arg...) const>
{
using functor_type = mem_functor<T_return (T_obj::*)(T_arg...) const, T_arg...>;
diff --git a/sigc++/functors/mem_fun.h b/sigc++/functors/mem_fun.h
index b4a1b68..65563a3 100644
--- a/sigc++/functors/mem_fun.h
+++ b/sigc++/functors/mem_fun.h
@@ -87,7 +87,7 @@ namespace sigc
* @ingroup sigcfunctors
*/
-template <typename T_func, typename... T_arg>
+template<typename T_func, typename... T_arg>
class mem_functor
{
public:
@@ -95,9 +95,8 @@ public:
using function_type = T_func;
- using obj_type_with_modifier =
- typename std::conditional_t<internal::member_method_is_const<T_func>::value, const object_type,
- object_type>;
+ using obj_type_with_modifier = typename std::
+ conditional_t<internal::member_method_is_const<T_func>::value, const object_type, object_type>;
/// Constructs an invalid functor.
mem_functor() : func_ptr_(nullptr) {}
@@ -121,7 +120,7 @@ protected:
function_type func_ptr_;
};
-template <typename T_func, typename... T_arg>
+template<typename T_func, typename... T_arg>
class bound_mem_functor : mem_functor<T_func, T_arg...>
{
using base_type = mem_functor<T_func, T_arg...>;
@@ -131,21 +130,18 @@ public:
using object_type = typename base_type::object_type;
- using obj_type_with_modifier =
- typename std::conditional_t<internal::member_method_is_const<T_func>::value, const object_type,
- object_type>;
+ using obj_type_with_modifier = typename std::
+ conditional_t<internal::member_method_is_const<T_func>::value, const object_type, object_type>;
using T_limit_reference =
typename std::conditional_t<internal::member_method_is_const<T_func>::value,
- limit_reference<const object_type>, limit_reference<object_type>>;
+ limit_reference<const object_type>,
+ limit_reference<object_type>>;
/** Constructs a bound_mem_functor object that wraps the passed method.
* @param obj Reference to instance the method will operate on.
* @param func Pointer to method will be invoked from operator()().
*/
- bound_mem_functor(obj_type_with_modifier& obj, function_type func)
- : base_type(func), obj_(obj)
- {
- }
+ bound_mem_functor(obj_type_with_modifier& obj, function_type func) : base_type(func), obj_(obj) {}
/** Execute the wrapped method operating on the stored instance.
* @param a Arguments to be passed on to the method.
@@ -170,12 +166,12 @@ public:
*
* @ingroup mem_fun
*/
-template <typename T_func, typename... T_arg>
+template<typename T_func, typename... T_arg>
struct visitor<bound_mem_functor<T_func, T_arg...>>
{
- template <typename T_action>
- static void do_visit_each(
- const T_action& action, const bound_mem_functor<T_func, T_arg...>& target)
+ template<typename T_action>
+ static void do_visit_each(const T_action& action,
+ const bound_mem_functor<T_func, T_arg...>& target)
{
sigc::visit_each(action, target.obj_);
}
@@ -188,9 +184,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...))
+template<typename T_return, typename T_obj, typename... 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);
}
@@ -201,7 +196,7 @@ mem_fun(T_return (T_obj::*func)(T_arg...))
*
* @ingroup mem_fun
*/
-template <typename T_return, typename T_obj, typename... T_arg>
+template<typename T_return, typename T_obj, typename... T_arg>
inline decltype(auto)
mem_fun(T_return (T_obj::*func)(T_arg...) const)
{
@@ -214,9 +209,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)
+template<typename T_return, typename T_obj, typename... T_arg>
+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);
}
@@ -227,7 +221,7 @@ mem_fun(T_return (T_obj::*func)(T_arg...) volatile)
*
* @ingroup mem_fun
*/
-template <typename T_return, typename T_obj, typename... T_arg>
+template<typename T_return, typename T_obj, typename... T_arg>
inline decltype(auto)
mem_fun(T_return (T_obj::*func)(T_arg...) const volatile)
{
@@ -242,7 +236,7 @@ mem_fun(T_return (T_obj::*func)(T_arg...) const volatile)
*
* @ingroup mem_fun
*/
-template <typename T_return, typename T_obj, typename T_obj2, typename... T_arg>
+template<typename T_return, typename T_obj, typename T_obj2, typename... T_arg>
inline decltype(auto)
mem_fun(/**/ T_obj& obj, T_return (T_obj2::*func)(T_arg...))
{
@@ -257,7 +251,7 @@ mem_fun(/**/ T_obj& obj, T_return (T_obj2::*func)(T_arg...))
*
* @ingroup mem_fun
*/
-template <typename T_return, typename T_obj, typename T_obj2, typename... T_arg>
+template<typename T_return, typename T_obj, typename T_obj2, typename... T_arg>
inline decltype(auto)
mem_fun(/*const*/ T_obj& obj, T_return (T_obj2::*func)(T_arg...) const)
{
@@ -272,7 +266,7 @@ mem_fun(/*const*/ T_obj& obj, T_return (T_obj2::*func)(T_arg...) const)
*
* @ingroup mem_fun
*/
-template <typename T_return, typename T_obj, typename T_obj2, typename... T_arg>
+template<typename T_return, typename T_obj, typename T_obj2, typename... T_arg>
inline decltype(auto)
mem_fun(/**/ T_obj& obj, T_return (T_obj2::*func)(T_arg...) volatile)
{
@@ -287,7 +281,7 @@ mem_fun(/**/ T_obj& obj, T_return (T_obj2::*func)(T_arg...) volatile)
*
* @ingroup mem_fun
*/
-template <typename T_return, typename T_obj, typename T_obj2, typename... T_arg>
+template<typename T_return, typename T_obj, typename T_obj2, typename... T_arg>
inline decltype(auto)
mem_fun(/*const*/ T_obj& obj, T_return (T_obj2::*func)(T_arg...) const volatile)
{
diff --git a/sigc++/functors/ptr_fun.h b/sigc++/functors/ptr_fun.h
index c680a2e..288ac87 100644
--- a/sigc++/functors/ptr_fun.h
+++ b/sigc++/functors/ptr_fun.h
@@ -68,10 +68,10 @@ namespace sigc
*
* @ingroup ptr_fun
*/
-template <typename T_return, typename... T_args>
+template<typename T_return, typename... T_args>
class pointer_functor;
-template <typename T_return, typename... T_args>
+template<typename T_return, typename... T_args>
class pointer_functor<T_return(T_args...)>
{
using function_type = T_return (*)(T_args...);
@@ -80,7 +80,6 @@ protected:
function_type func_ptr_;
public:
-
/// Constructs an invalid functor.
pointer_functor() = default;
@@ -93,9 +92,7 @@ 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 {
- return std::invoke(func_ptr_, a...);
- }
+ T_return operator()(type_trait_take_t<T_args>... a) const { return std::invoke(func_ptr_, a...); }
};
/** Creates a functor of type sigc::pointer_functor which wraps an existing non-member function.
@@ -104,7 +101,7 @@ public:
*
* @ingroup ptr_fun
*/
-template <typename T_return, typename... T_args>
+template<typename T_return, typename... T_args>
inline decltype(auto) ptr_fun(T_return (*func)(T_args...))
{
return pointer_functor<T_return(T_args...)>(func);
diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h
index 5cda9cc..971de65 100644
--- a/sigc++/functors/slot.h
+++ b/sigc++/functors/slot.h
@@ -47,8 +47,9 @@ namespace internal
* function_pointer_cast<>() (perhaps glibmm), can be ambiguous due to ADL
* (argument-dependent lookup).
*/
-template <typename T_out, typename T_in>
-inline T_out function_pointer_cast(T_in in)
+template<typename T_out, typename T_in>
+inline T_out
+function_pointer_cast(T_in in)
{
// The double reinterpret_cast suppresses a warning from gcc8 with the
// -Wcast-function-type option.
@@ -62,15 +63,15 @@ inline T_out function_pointer_cast(T_in in)
* notification callback. Consequently the slot_rep object will be
* notified when some referred object is destroyed or overwritten.
*/
-template <typename T_functor>
+template<typename T_functor>
struct typed_slot_rep : public slot_rep
{
private:
/* Use an adaptor type so that arguments can be passed as const references
* through explicit template instantiation from slot_call#::call_it() */
using adaptor_type = typename adaptor_trait<T_functor>::adaptor_type;
-public:
+public:
/** The functor contained by this slot_rep object. */
std::unique_ptr<adaptor_type> functor_;
@@ -139,7 +140,7 @@ private:
* - @e T_arg Argument types used in the definition of call_it().
*
*/
-template <typename T_functor, typename T_return, typename... T_arg>
+template<typename T_functor, typename T_return, typename... T_arg>
struct slot_call
{
/** Invokes a functor of type @p T_functor.
@@ -191,15 +192,15 @@ struct slot_call
* @ingroup slot
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-template <typename T_return, typename... T_arg>
+template<typename T_return, typename... T_arg>
class slot;
#endif // DOXYGEN_SHOULD_SKIP_THIS
-template <typename T_return, typename... T_arg>
+template<typename T_return, typename... T_arg>
class slot<T_return(T_arg...)> : public slot_base
{
public:
-// TODO: using arg_type_ = type_trait_take_t<T_arg>;
+ // TODO: using arg_type_ = type_trait_take_t<T_arg>;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
@@ -215,8 +216,11 @@ public:
*/
inline T_return operator()(type_trait_take_t<T_arg>... a) const
{
- if (!empty() && !blocked()) {
- return std::invoke(sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_), slot_base::rep_, a...);
+ if (!empty() && !blocked())
+ {
+ return std::invoke(sigc::internal::function_pointer_cast<call_type>(slot_base::rep_->call_),
+ slot_base::rep_,
+ a...);
}
return T_return();
@@ -227,7 +231,7 @@ public:
/** Constructs a slot from an arbitrary functor.
* @param func The desired functor the new slot should be assigned to.
*/
- template <typename T_functor>
+ template<typename T_functor>
slot(const T_functor& func) : slot_base(new internal::typed_slot_rep<T_functor>(func))
{
// The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
@@ -249,8 +253,7 @@ public:
* @param src The slot from which to make a copy.
* @return @p this.
*/
- slot& operator=(const slot& src)
- = default;
+ slot& operator=(const slot& src) = default;
/** Overrides this slot, making a move from another slot.
* If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
@@ -287,15 +290,15 @@ public:
*
* @ingroup slot
*/
-template <typename T_return, typename... T_arg>
+template<typename T_return, typename... T_arg>
struct visitor<slot<T_return, T_arg...>>
{
- static void do_visit_each(
- const internal::limit_trackable_target<internal::slot_do_bind>& action,
+ static void do_visit_each(const internal::limit_trackable_target<internal::slot_do_bind>& action,
const slot<T_return, T_arg...>& target)
{
if (target.rep_ && target.rep_->parent_ == nullptr)
- target.rep_->set_parent(action.action_.rep_, &internal::slot_rep::notify_slot_rep_invalidated);
+ target.rep_->set_parent(
+ action.action_.rep_, &internal::slot_rep::notify_slot_rep_invalidated);
}
static void do_visit_each(
@@ -306,7 +309,7 @@ struct visitor<slot<T_return, T_arg...>>
target.rep_->unset_parent();
}
- template <typename T_action>
+ template<typename T_action>
static void do_visit_each(const T_action& action, const slot<T_return, T_arg...>& target)
{
action(target);
diff --git a/sigc++/functors/slot_base.cc b/sigc++/functors/slot_base.cc
index 106f229..b3419c9 100644
--- a/sigc++/functors/slot_base.cc
+++ b/sigc++/functors/slot_base.cc
@@ -92,13 +92,9 @@ slot_rep::notify_slot_rep_invalidated(notifiable* data)
} // namespace internal
-slot_base::slot_base() noexcept : rep_(nullptr), blocked_(false)
-{
-}
+slot_base::slot_base() noexcept : rep_(nullptr), blocked_(false) {}
-slot_base::slot_base(rep_type* rep) noexcept : rep_(rep), blocked_(false)
-{
-}
+slot_base::slot_base(rep_type* rep) noexcept : rep_(rep), blocked_(false) {}
slot_base::slot_base(const slot_base& src) : rep_(nullptr), blocked_(src.blocked_)
{
diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h
index 55cf3e6..1f7589c 100644
--- a/sigc++/functors/slot_base.h
+++ b/sigc++/functors/slot_base.h
@@ -66,12 +66,7 @@ public:
* down dereferencing of slot list iterators. Martin. */
// TODO: Try this now? murrayc.
- inline slot_rep(hook call__) noexcept
- : call_(call__),
- cleanup_(nullptr),
- parent_(nullptr)
- {
- }
+ inline slot_rep(hook call__) noexcept : call_(call__), cleanup_(nullptr), parent_(nullptr) {}
virtual ~slot_rep() {}
@@ -383,4 +378,4 @@ private:
} // namespace sigc
-#endif //SIGC_SLOT_BASE_HPP
+#endif // SIGC_SLOT_BASE_HPP
diff --git a/sigc++/limit_reference.h b/sigc++/limit_reference.h
index b57e4e0..f578cc3 100644
--- a/sigc++/limit_reference.h
+++ b/sigc++/limit_reference.h
@@ -46,7 +46,7 @@ namespace sigc
*
* - @e T_type The type of the reference.
*/
-template <typename T_type,
+template<typename T_type,
bool I_derives_trackable = std::is_base_of<trackable, std::decay_t<T_type>>::value>
class limit_reference
{
@@ -88,7 +88,7 @@ private:
/** limit_reference object for a class that derives from trackable.
* - @e T_type The type of the reference.
*/
-template <typename T_type>
+template<typename T_type>
class limit_reference<T_type, true>
{
public:
@@ -134,10 +134,10 @@ private:
* @param action The functor to invoke.
* @param target The visited instance.
*/
-template <typename T_type>
+template<typename T_type>
struct visitor<limit_reference<T_type>>
{
- template <typename T_action>
+ template<typename T_action>
static void do_visit_each(const T_action& action, const limit_reference<T_type>& target)
{
sigc::visit_each(action, target.visit());
diff --git a/sigc++/member_method_trait.h b/sigc++/member_method_trait.h
index 37c77cb..344785e 100644
--- a/sigc++/member_method_trait.h
+++ b/sigc++/member_method_trait.h
@@ -27,55 +27,55 @@ namespace sigc
namespace internal
{
-template <typename>
+template<typename>
struct member_method_is_const;
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_is_const<T_result (T_obj::*)(T_arg...)>
{
constexpr static bool value = false;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_is_const<T_result (T_obj::*)(T_arg...) volatile>
{
constexpr static bool value = false;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_is_const<T_result (T_obj::*)(T_arg...) const>
{
constexpr static bool value = true;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_is_const<T_result (T_obj::*)(T_arg...) const volatile>
{
constexpr static bool value = true;
};
-template <typename>
+template<typename>
struct member_method_is_volatile;
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_is_volatile<T_result (T_obj::*)(T_arg...)>
{
constexpr static bool value = false;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_is_volatile<T_result (T_obj::*)(T_arg...) const>
{
constexpr static bool value = false;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_is_volatile<T_result (T_obj::*)(T_arg...) volatile>
{
constexpr static bool value = true;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_is_volatile<T_result (T_obj::*)(T_arg...) const volatile>
{
constexpr static bool value = true;
@@ -83,30 +83,30 @@ struct member_method_is_volatile<T_result (T_obj::*)(T_arg...) const volatile>
// member method class:
-template <typename T_result, typename... T_arg>
+template<typename T_result, typename... T_arg>
struct member_method_class
{
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_class<T_result (T_obj::*)(T_arg...)>
{
using type = T_obj;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_class<T_result (T_obj::*)(T_arg...) volatile>
{
using type = T_obj;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_class<T_result (T_obj::*)(T_arg...) const>
{
using type = T_obj;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_class<T_result (T_obj::*)(T_arg...) const volatile>
{
using type = T_obj;
@@ -114,30 +114,30 @@ struct member_method_class<T_result (T_obj::*)(T_arg...) const volatile>
// member method result:
-template <typename T_result, typename... T_arg>
+template<typename T_result, typename... T_arg>
struct member_method_result
{
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_result<T_result (T_obj::*)(T_arg...)>
{
using type = T_result;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_result<T_result (T_obj::*)(T_arg...) volatile>
{
using type = T_result;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_result<T_result (T_obj::*)(T_arg...) const>
{
using type = T_result;
};
-template <typename T_obj, typename T_result, typename... T_arg>
+template<typename T_obj, typename T_result, typename... T_arg>
struct member_method_result<T_result (T_obj::*)(T_arg...) const volatile>
{
using type = T_result;
diff --git a/sigc++/reference_wrapper.h b/sigc++/reference_wrapper.h
index 780d941..f5f12eb 100644
--- a/sigc++/reference_wrapper.h
+++ b/sigc++/reference_wrapper.h
@@ -24,32 +24,32 @@
namespace sigc
{
-template <typename T_type>
+template<typename T_type>
struct unwrap_reference
{
using type = T_type;
};
-template <typename T_type>
+template<typename T_type>
struct unwrap_reference<std::reference_wrapper<T_type>>
{
using type = T_type&;
};
-template <typename T_type>
+template<typename T_type>
struct unwrap_reference<std::reference_wrapper<const T_type>>
{
using type = const T_type&;
};
-template <typename T_type>
+template<typename T_type>
T_type&
unwrap(const std::reference_wrapper<T_type>& v)
{
return v;
}
-template <typename T_type>
+template<typename T_type>
const T_type&
unwrap(const std::reference_wrapper<const T_type>& v)
{
diff --git a/sigc++/signal.h b/sigc++/signal.h
index a819ba9..455223e 100644
--- a/sigc++/signal.h
+++ b/sigc++/signal.h
@@ -41,7 +41,7 @@ namespace internal
* the slot. The return value is buffered, so that in an expression
* like @code a = (*i) * (*i); @endcode the slot is executed only once.
*/
-template <typename T_emitter, typename T_result = typename T_emitter::result_type>
+template<typename T_emitter, typename T_result = typename T_emitter::result_type>
struct slot_iterator_buf
{
using size_type = std::size_t;
@@ -124,7 +124,7 @@ private:
/** Template specialization of slot_iterator_buf for void return signals.
*/
-template <typename T_emitter>
+template<typename T_emitter>
struct slot_iterator_buf<T_emitter, void>
{
using size_type = std::size_t;
@@ -228,7 +228,7 @@ private:
* emission when no accumulator is used, for example when the template
* argument @e T_accumulator is @p void.
*/
-template <typename T_return, typename T_accumulator, typename... T_arg>
+template<typename T_return, typename T_accumulator, typename... T_arg>
struct signal_emit
{
using self_type = signal_emit<T_return, T_accumulator, T_arg...>;
@@ -244,17 +244,15 @@ struct signal_emit
* @param slot Some slot to invoke.
* @return The slot's return value.
*/
- T_return operator()(const slot_type& slot) const
- {
- return std::apply(slot, a_);
- }
+ T_return operator()(const slot_type& slot) const { return std::apply(slot, a_); }
/** Executes a list of slots using an accumulator of type @e T_accumulator.
* The arguments are buffered in a temporary instance of signal_emit.
* @param a Arguments to be passed on to the slots.
* @return The accumulated return values of the slot invocations as processed by the accumulator.
*/
- static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl, type_trait_take_t<T_arg>... a)
+ static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl,
+ type_trait_take_t<T_arg>... a)
{
using slot_iterator_buf_type = internal::slot_iterator_buf<self_type, T_return>;
@@ -279,7 +277,7 @@ private:
* This template specialization implements an optimized emit()
* function for the case that no accumulator is used.
*/
-template <typename T_return, typename... T_arg>
+template<typename T_return, typename... T_arg>
struct signal_emit<T_return, void, T_arg...>
{
private:
@@ -287,7 +285,6 @@ private:
using call_type = typename slot_type::call_type;
public:
-
/** Executes a list of slots.
* The arguments are passed directly on to the slots.
* The return value of the last slot invoked is returned.
@@ -296,7 +293,8 @@ public:
* @param a Arguments to be passed on to the slots.
* @return The return value of the last slot invoked.
*/
- static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl, type_trait_take_t<T_arg>... a)
+ static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl,
+ type_trait_take_t<T_arg>... a)
{
if (!impl || impl->slots_.empty())
return T_return();
@@ -340,7 +338,7 @@ public:
* function for the case that no accumulator is used and the
* return type is @p void.
*/
-template <typename... T_arg>
+template<typename... T_arg>
struct signal_emit<void, void, T_arg...>
{
private:
@@ -348,12 +346,12 @@ private:
using call_type = typename slot_type::call_type;
public:
-
/** Executes a list of slots using an accumulator of type @e T_accumulator.
* The arguments are passed directly on to the slots.
* @param a Arguments to be passed on to the slots.
*/
- static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl, type_trait_take_t<T_arg>... a)
+ static decltype(auto) emit(const std::shared_ptr<internal::signal_impl>& impl,
+ type_trait_take_t<T_arg>... a)
{
if (!impl || impl->slots_.empty())
return;
@@ -396,7 +394,7 @@ public:
*
* @ingroup signal
*/
-template <typename T_return, typename T_accumulator, typename... T_arg>
+template<typename T_return, typename T_accumulator, typename... T_arg>
class signal_with_accumulator : public signal_base
{
public:
@@ -467,8 +465,9 @@ public:
*/
decltype(auto) make_slot() const
{
- //TODO: Instead use std::result_of<> on the static emitter_type::emit()
- using result_type = typename internal::member_method_result<decltype(&signal_with_accumulator::emit)>::type;
+ // TODO: Instead use std::result_of<> on the static emitter_type::emit()
+ using result_type =
+ typename internal::member_method_result<decltype(&signal_with_accumulator::emit)>::type;
return bound_mem_functor<result_type (signal_with_accumulator::*)(type_trait_take_t<T_arg>...)
const,
type_trait_take_t<T_arg>...>(*this, &signal_with_accumulator::emit);
@@ -530,11 +529,11 @@ public:
* @ingroup signal
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-template <typename T_return, typename... T_arg>
+template<typename T_return, typename... T_arg>
class signal;
#endif // DOXYGEN_SHOULD_SKIP_THIS
-template <typename T_return, typename... T_arg>
+template<typename T_return, typename... T_arg>
class signal<T_return(T_arg...)> : public signal_with_accumulator<T_return, void, T_arg...>
{
public:
@@ -583,7 +582,7 @@ public:
*
* @ingroup signal
*/
- template <typename T_accumulator>
+ template<typename T_accumulator>
class accumulated : public signal_with_accumulator<T_return, T_accumulator, T_arg...>
{
public:
diff --git a/sigc++/signal_base.cc b/sigc++/signal_base.cc
index 67f493e..c92a091 100644
--- a/sigc++/signal_base.cc
+++ b/sigc++/signal_base.cc
@@ -33,12 +33,12 @@ struct self_and_iter : public notifiable
const signal_impl::iterator_type iter_;
self_and_iter(const std::weak_ptr<signal_impl>& self, const signal_impl::iterator_type& iter)
- : self_(self), iter_(iter) {}
+ : self_(self), iter_(iter)
+ {
+ }
};
-signal_impl::signal_impl() : exec_count_(0), deferred_(false)
-{
-}
+signal_impl::signal_impl() : exec_count_(0), deferred_(false) {}
signal_impl::~signal_impl()
{
@@ -204,22 +204,16 @@ signal_impl::notify_self_and_iter_of_invalidated_slot(notifiable* d)
} /* namespace internal */
-signal_base::signal_base() noexcept
-{
-}
+signal_base::signal_base() noexcept {}
-signal_base::signal_base(const signal_base& src) noexcept : impl_(src.impl())
-{
-}
+signal_base::signal_base(const signal_base& src) noexcept : impl_(src.impl()) {}
signal_base::signal_base(signal_base&& src) : impl_(std::move(src.impl_))
{
src.impl_ = nullptr;
}
-signal_base::~signal_base()
-{
-}
+signal_base::~signal_base() {}
void
signal_base::clear()
diff --git a/sigc++/signal_base.h b/sigc++/signal_base.h
index 3bbcd4f..647ee02 100644
--- a/sigc++/signal_base.h
+++ b/sigc++/signal_base.h
@@ -42,8 +42,7 @@ namespace internal
* or defers the execution of erase() to sweep() when the signal is being emitted.
* sweep() removes all invalid slots from the list.
*/
-struct SIGC_API signal_impl
- : public std::enable_shared_from_this<signal_impl>
+struct SIGC_API signal_impl : public std::enable_shared_from_this<signal_impl>
{
using size_type = std::size_t;
using slot_list = std::list<slot_base>;
@@ -66,10 +65,7 @@ struct SIGC_API signal_impl
#endif
/// Increments the reference and execution counter.
- inline void reference_exec() noexcept
- {
- ++exec_count_;
- }
+ inline void reference_exec() noexcept { ++exec_count_; }
/** Decrements the reference and execution counter.
* Invokes sweep() if the execution counter reaches zero and the
@@ -178,8 +174,7 @@ struct SIGC_API signal_impl_exec_holder
/** Increments the execution counter of the parent sigc::signal_impl object.
* @param sig The parent sigc::signal_impl object.
*/
- inline explicit signal_impl_exec_holder(signal_impl* sig) noexcept
- : sig_(sig)
+ inline explicit signal_impl_exec_holder(signal_impl* sig) noexcept : sig_(sig)
{
sig_->reference_exec();
}
diff --git a/sigc++/trackable.cc b/sigc++/trackable.cc
index fdff747..c4cc822 100644
--- a/sigc++/trackable.cc
+++ b/sigc++/trackable.cc
@@ -22,15 +22,11 @@
namespace sigc
{
-trackable::trackable() noexcept : callback_list_(nullptr)
-{
-}
+trackable::trackable() noexcept : callback_list_(nullptr) {}
/* Don't copy the notification list.
The objects watching src don't need to be notified when the new object dies. */
-trackable::trackable(const trackable& /*src*/) noexcept : callback_list_(nullptr)
-{
-}
+trackable::trackable(const trackable& /*src*/) noexcept : callback_list_(nullptr) {}
// Don't move the notification list.
// The objects watching src don't need to be notified when the new object dies.
@@ -38,8 +34,7 @@ trackable::trackable(const trackable& /*src*/) noexcept : callback_list_(nullptr
//
// If trackable's move constructor is modified, check if Glib::Object's
// move constructor should be modified similarly.
-trackable::trackable(trackable&& src) noexcept
-: callback_list_(nullptr)
+trackable::trackable(trackable&& src) noexcept : callback_list_(nullptr)
{
src.notify_callbacks();
}
diff --git a/sigc++/tuple-utils/tuple_cdr.h b/sigc++/tuple-utils/tuple_cdr.h
index 8577fef..a4c9e59 100644
--- a/sigc++/tuple-utils/tuple_cdr.h
+++ b/sigc++/tuple-utils/tuple_cdr.h
@@ -22,26 +22,27 @@
#include <type_traits>
#include <utility>
-namespace sigc::internal {
+namespace sigc::internal
+{
/**
* Get the type of a tuple without the first item.
*/
-template <typename T>
+template<typename T>
struct tuple_type_cdr; // primary template is not defined
// Partial specialization for tuples of at least one element:
-template <typename H, typename... T>
+template<typename H, typename... T>
struct tuple_type_cdr<std::tuple<H, T...>>
{
using type = std::tuple<T...>;
};
-namespace detail {
+namespace detail
+{
-template <typename T, std::size_t... I>
-constexpr
-decltype(auto)
+template<typename T, std::size_t... I>
+constexpr decltype(auto)
tuple_cdr_impl(T&& t, std::index_sequence<0, I...>)
{
using cdr = typename tuple_type_cdr<std::decay_t<T>>::type;
@@ -54,11 +55,11 @@ tuple_cdr_impl(T&& t, std::index_sequence<0, I...>)
* Get the a tuple without the first item.
* This is analogous to std::tuple_cat().
*/
-template <typename T>
-constexpr
-decltype(auto)
-tuple_cdr(T&& t) {
- //We use std::decay_t<> because tuple_size is not defined for references.
+template<typename T>
+constexpr decltype(auto)
+tuple_cdr(T&& t)
+{
+ // We use std::decay_t<> because tuple_size is not defined for references.
constexpr auto size = std::tuple_size<std::decay_t<T>>::value;
static_assert(size != 0, "tuple size must be non-zero");
@@ -68,4 +69,4 @@ tuple_cdr(T&& t) {
} // namespace sigc::internal
-#endif //SIGC_TUPLE_UTILS_TUPLE_CDR_H
+#endif // SIGC_TUPLE_UTILS_TUPLE_CDR_H
diff --git a/sigc++/tuple-utils/tuple_end.h b/sigc++/tuple-utils/tuple_end.h
index 6c47a34..966a6c8 100644
--- a/sigc++/tuple-utils/tuple_end.h
+++ b/sigc++/tuple-utils/tuple_end.h
@@ -20,18 +20,22 @@
#include <sigc++/tuple-utils/tuple_cdr.h>
-namespace sigc::internal {
+namespace sigc::internal
+{
-namespace detail {
+namespace detail
+{
-template <typename T, std::size_t remove_from_start>
-struct tuple_type_end_impl {
+template<typename T, std::size_t remove_from_start>
+struct tuple_type_end_impl
+{
using type = typename tuple_type_end_impl<typename tuple_type_cdr<std::decay_t<T>>::type,
remove_from_start - 1>::type;
};
-template <typename T>
-struct tuple_type_end_impl<T, 0> {
+template<typename T>
+struct tuple_type_end_impl<T, 0>
+{
using type = T;
};
@@ -40,37 +44,44 @@ struct tuple_type_end_impl<T, 0> {
/**
* Get the type of a tuple with the last @a len types of the original.
*/
-template <typename T, std::size_t len>
-struct tuple_type_end
- : detail::tuple_type_end_impl<T, std::tuple_size<T>::value - len> {};
+template<typename T, std::size_t len>
+struct tuple_type_end : detail::tuple_type_end_impl<T, std::tuple_size<T>::value - len>
+{
+};
/**
* Get the tuple with the last @a len items of the original.
*/
-template <std::size_t len, typename T>
-constexpr
-decltype(auto) // typename tuple_type_end<T, len>::type
-tuple_end(T&& t) {
- //We use std::decay_t<> because tuple_size is not defined for references.
+template<std::size_t len, typename T>
+constexpr decltype(auto) // typename tuple_type_end<T, len>::type
+tuple_end(T&& t)
+{
+ // We use std::decay_t<> because tuple_size is not defined for references.
constexpr auto size = std::tuple_size<std::decay_t<T>>::value;
static_assert(len <= size, "The tuple size must be less than or equal to the length.");
- if constexpr(len == 0) {
+ if constexpr (len == 0)
+ {
// Prevent 'unreferenced formal parameter' warning from MSVC by 'using' t
static_cast<void>(t);
// Recursive calls to tuple_cdr() would result in this eventually,
// but this avoids the extra work:
return std::tuple<>();
- } else if constexpr(size - len == 0) {
+ }
+ else if constexpr (size - len == 0)
+ {
return std::forward<T>(t);
- } else if constexpr(size - len == 1) {
+ }
+ else if constexpr (size - len == 1)
+ {
return tuple_cdr(std::forward<T>(t));
- } else {
- return tuple_end<len>(
- tuple_cdr(std::forward<T>(t)));
+ }
+ else
+ {
+ return tuple_end<len>(tuple_cdr(std::forward<T>(t)));
}
}
} // namespace sigc::internal;
-#endif //SIGC_TUPLE_UTILS_TUPLE_END_H
+#endif // SIGC_TUPLE_UTILS_TUPLE_END_H
diff --git a/sigc++/tuple-utils/tuple_for_each.h b/sigc++/tuple-utils/tuple_for_each.h
index 5296b70..7b7fb24 100644
--- a/sigc++/tuple-utils/tuple_for_each.h
+++ b/sigc++/tuple-utils/tuple_for_each.h
@@ -29,10 +29,10 @@ namespace internal
namespace detail
{
-template <template <typename> class T_visitor, std::size_t size_from_index, typename... T_extras>
+template<template<typename> class T_visitor, std::size_t size_from_index, typename... T_extras>
struct tuple_for_each_impl
{
- template <typename T>
+ template<typename T>
constexpr static void tuple_for_each(T&& t, T_extras&&... extras)
{
// We use std::decay_t<> because tuple_size is not defined for references.
@@ -50,10 +50,10 @@ struct tuple_for_each_impl
}
};
-template <template <typename> class T_visitor, typename... T_extras>
+template<template<typename> class T_visitor, typename... T_extras>
struct tuple_for_each_impl<T_visitor, 1, T_extras...>
{
- template <typename T>
+ template<typename T>
constexpr static void tuple_for_each(T&& t, T_extras&&... extras)
{
// We use std::decay_t<> because tuple_size is not defined for references.
@@ -69,10 +69,10 @@ struct tuple_for_each_impl<T_visitor, 1, T_extras...>
}
};
-template <template <typename> class T_visitor, typename... T_extras>
+template<template<typename> class T_visitor, typename... T_extras>
struct tuple_for_each_impl<T_visitor, 0, T_extras...>
{
- template <typename T>
+ template<typename T>
constexpr static void tuple_for_each(T&& /* t */, T_extras&&... /* extras */)
{
// Do nothing because the tuple has no elements.
@@ -92,7 +92,7 @@ struct tuple_for_each_impl<T_visitor, 0, T_extras...>
* @param t The tuple whose elements should be visited.
* @param extras Any extra arguments to pass to @e T_Visitor's visit() method.
*/
-template <template <typename> class T_visitor, typename T, typename... T_extras>
+template<template<typename> class T_visitor, typename T, typename... T_extras>
constexpr void
tuple_for_each(T&& t, T_extras&&... extras)
{
@@ -103,7 +103,9 @@ tuple_for_each(T&& t, T_extras&&... extras)
{
detail::tuple_for_each_impl<T_visitor, size, T_extras...>::tuple_for_each(
std::forward<T>(t), std::forward<T_extras>(extras)...);
- } else {
+ }
+ else
+ {
// Prevent 'unreferenced formal parameter' warning from MSVC by 'using' t
static_cast<void>(t);
}
diff --git a/sigc++/tuple-utils/tuple_start.h b/sigc++/tuple-utils/tuple_start.h
index c220a92..6c83030 100644
--- a/sigc++/tuple-utils/tuple_start.h
+++ b/sigc++/tuple-utils/tuple_start.h
@@ -21,15 +21,18 @@
#include <tuple>
#include <utility>
-namespace sigc::internal {
+namespace sigc::internal
+{
-namespace detail {
+namespace detail
+{
-template <typename T, typename Seq>
+template<typename T, typename Seq>
struct tuple_type_start_impl;
-template <typename T, std::size_t... I>
-struct tuple_type_start_impl<T, std::index_sequence<I...>> {
+template<typename T, std::size_t... I>
+struct tuple_type_start_impl<T, std::index_sequence<I...>>
+{
using type = std::tuple<typename std::tuple_element<I, T>::type...>;
};
@@ -38,21 +41,22 @@ struct tuple_type_start_impl<T, std::index_sequence<I...>> {
/**
* Get the type of a tuple with just the first @len items.
*/
-template <typename T, std::size_t len>
-struct tuple_type_start
- : detail::tuple_type_start_impl<T, std::make_index_sequence<len>> {};
+template<typename T, std::size_t len>
+struct tuple_type_start : detail::tuple_type_start_impl<T, std::make_index_sequence<len>>
+{
+};
-namespace detail {
+namespace detail
+{
-template <typename T, typename Seq>
+template<typename T, typename Seq>
struct tuple_start_impl;
-template <typename T, std::size_t... I>
-struct tuple_start_impl<T, std::index_sequence<I...>> {
- static
- constexpr
- decltype(auto)
- tuple_start(T&& t) {
+template<typename T, std::size_t... I>
+struct tuple_start_impl<T, std::index_sequence<I...>>
+{
+ static constexpr decltype(auto) tuple_start(T&& t)
+ {
constexpr auto size = std::tuple_size<std::decay_t<T>>::value;
constexpr auto len = sizeof...(I);
static_assert(len <= size, "The tuple size must be less than or equal to the length.");
@@ -67,11 +71,11 @@ struct tuple_start_impl<T, std::index_sequence<I...>> {
/**
* Get the tuple with the last @a len items of the original.
*/
-template <std::size_t len, typename T>
-constexpr
-decltype(auto) // typename tuple_type_end<T, len>::type
-tuple_start(T&& t) {
- //We use std::decay_t<> because tuple_size is not defined for references.
+template<std::size_t len, typename T>
+constexpr decltype(auto) // typename tuple_type_end<T, len>::type
+tuple_start(T&& t)
+{
+ // We use std::decay_t<> because tuple_size is not defined for references.
constexpr auto size = std::tuple_size<std::decay_t<T>>::value;
static_assert(len <= size, "The tuple size must be less than or equal to the length.");
@@ -81,4 +85,4 @@ tuple_start(T&& t) {
} // namespace sigc::internal;
-#endif //SIGC_TUPLE_UTILS_TUPLE_START_H
+#endif // SIGC_TUPLE_UTILS_TUPLE_START_H
diff --git a/sigc++/tuple-utils/tuple_transform_each.h b/sigc++/tuple-utils/tuple_transform_each.h
index fa1f7a8..570e59b 100644
--- a/sigc++/tuple-utils/tuple_transform_each.h
+++ b/sigc++/tuple-utils/tuple_transform_each.h
@@ -23,43 +23,52 @@
#include <sigc++/tuple-utils/tuple_start.h>
#include <type_traits>
-namespace sigc::internal {
+namespace sigc::internal
+{
-namespace detail {
+namespace detail
+{
-template <template <typename> class T_transformer, std::size_t size_from_index>
-struct tuple_transform_each_impl {
+template<template<typename> class T_transformer, std::size_t size_from_index>
+struct tuple_transform_each_impl
+{
// TODO: Avoid the need to pass t_original all the way into the recursion?
- template <typename T_current, typename T_original>
- constexpr
- static decltype(auto)
- tuple_transform_each(T_current&& t, T_original& t_original) {
- if constexpr(size_from_index == 0) {
- // Prevent 'unreferenced formal parameter' warning from MSVC by 'using'
- // t_original
+ template<typename T_current, typename T_original>
+ constexpr static decltype(auto) tuple_transform_each(T_current&& t, T_original& t_original)
+ {
+ if constexpr (size_from_index == 0)
+ {
+ // Prevent 'unreferenced formal parameter' warning from MSVC by 'using'
+ // t_original
static_cast<void>(t_original);
- //Do nothing because the tuple has no elements.
+ // Do nothing because the tuple has no elements.
return std::forward<T_current>(t);
- } else { //TODO: Should this compile without using else to contain the alternative code?
- //We use std::decay_t<> because tuple_size is not defined for references.
+ }
+ else
+ { // TODO: Should this compile without using else to contain the alternative code?
+ // We use std::decay_t<> because tuple_size is not defined for references.
constexpr auto size = std::tuple_size<std::decay_t<T_current>>::value;
constexpr auto index = size - size_from_index;
static_assert(index >= 0, "unexpected index.");
using from_element_type = typename std::tuple_element<index, std::decay_t<T_original>>::type;
- using to_element_type = typename std::invoke_result<decltype (
- &T_transformer<from_element_type>::transform), from_element_type&>::type;
+ using to_element_type =
+ typename std::invoke_result<decltype(&T_transformer<from_element_type>::transform),
+ from_element_type&>::type;
// Tuples which are input data to std::tuple_cat() should not be declared const.
// Some versions of libc++ has a bug in std::tuple_cat(): All output elements
// coming from a const tuple become const.
// https://github.com/libsigcplusplus/libsigcplusplus/issues/25
- auto t_element =
- std::tuple<to_element_type>(T_transformer<from_element_type>::transform(std::get<index>(t_original)));
+ auto t_element = std::tuple<to_element_type>(
+ T_transformer<from_element_type>::transform(std::get<index>(t_original)));
- if constexpr(size_from_index == 1) {
+ if constexpr (size_from_index == 1)
+ {
auto tuple_rest = tuple_start<size - 1>(std::forward<T_current>(t));
return std::tuple_cat(tuple_rest, t_element);
- } else {
+ }
+ else
+ {
auto t_start = tuple_start<index>(std::forward<T_current>(t));
// t_end's elements will be copies of the elements in t, so this method's
@@ -71,8 +80,8 @@ struct tuple_transform_each_impl {
auto t_end = tuple_end<size - index - 1>(t);
auto t_with_transformed_element = std::tuple_cat(t_start, t_element, t_end);
- return tuple_transform_each_impl<T_transformer,
- size_from_index - 1>::tuple_transform_each(t_with_transformed_element, t_original);
+ return tuple_transform_each_impl<T_transformer, size_from_index - 1>::tuple_transform_each(
+ t_with_transformed_element, t_original);
}
}
}
@@ -84,17 +93,17 @@ struct tuple_transform_each_impl {
* Get a tuple with each element having the transformed value of the element
* in the original tuple.
*/
-template <template <typename> class T_transformer, typename T>
-constexpr
-decltype(auto)
-tuple_transform_each(T&& t) {
- //We use std::decay_t<> because tuple_size is not defined for references.
+template<template<typename> class T_transformer, typename T>
+constexpr decltype(auto)
+tuple_transform_each(T&& t)
+{
+ // We use std::decay_t<> because tuple_size is not defined for references.
constexpr auto size = std::tuple_size<std::decay_t<T>>::value;
- return detail::tuple_transform_each_impl<T_transformer,
- size>::tuple_transform_each(std::forward<T>(t), t);
+ return detail::tuple_transform_each_impl<T_transformer, size>::tuple_transform_each(
+ std::forward<T>(t), t);
}
} // namespace sigc::internal
-#endif //SIGC_TUPLE_UTILS_TUPLE_TRANSFORM_EACH_H
+#endif // SIGC_TUPLE_UTILS_TUPLE_TRANSFORM_EACH_H
diff --git a/sigc++/type_traits.h b/sigc++/type_traits.h
index 849f75f..1af84e1 100644
--- a/sigc++/type_traits.h
+++ b/sigc++/type_traits.h
@@ -24,45 +24,45 @@
namespace sigc
{
-template <typename T_type>
+template<typename T_type>
struct type_trait
{
using pass = T_type&;
using take = const T_type&;
};
-template <typename T_type, int N>
+template<typename T_type, int N>
struct type_trait<T_type[N]>
{
using pass = T_type*&;
using take = const T_type*&;
};
-template <typename T_type>
+template<typename T_type>
struct type_trait<T_type&>
{
using pass = T_type&;
using take = T_type&;
};
-template <typename T_type>
+template<typename T_type>
struct type_trait<const T_type&>
{
using pass = const T_type&;
using take = const T_type&;
};
-template <>
+template<>
struct type_trait<void>
{
using pass = void;
using take = void;
};
-template <typename T>
+template<typename T>
using type_trait_pass_t = typename type_trait<T>::pass;
-template <typename T>
+template<typename T>
using type_trait_take_t = typename type_trait<T>::take;
} /* namespace sigc */
diff --git a/sigc++/visit_each.h b/sigc++/visit_each.h
index 032068a..39ee408 100644
--- a/sigc++/visit_each.h
+++ b/sigc++/visit_each.h
@@ -32,23 +32,26 @@ struct trackable;
namespace internal
{
-template <typename Base, typename Derived>
+template<typename Base, typename Derived>
constexpr bool is_base_of_or_same_v =
std::is_base_of<std::decay_t<Base>, std::decay_t<Derived>>::value ||
- std::is_same<std::decay_t<Base>, std::decay_t<Derived>>::value;
+ std::is_same<std::decay_t<Base>, std::decay_t<Derived>>::value;
/// Helper struct for visit_each_trackable().
-template <typename T_action>
+template<typename T_action>
struct limit_trackable_target
{
- template <typename T_type>
+ template<typename T_type>
void operator()(T_type&& type) const
{
- //Only call action_() if T_Type derives from trackable.
- if constexpr(is_base_of_or_same_v<sigc::trackable, T_type>) {
- std::invoke(action_, type);
- } else {
- // Prevent 'unreferenced formal parameter' warning from MSVC by 'using' type
+ // Only call action_() if T_Type derives from trackable.
+ if constexpr (is_base_of_or_same_v<sigc::trackable, T_type>)
+ {
+ std::invoke(action_, type);
+ }
+ else
+ {
+ // Prevent 'unreferenced formal parameter' warning from MSVC by 'using' type
static_cast<void>(type);
}
}
@@ -110,10 +113,10 @@ struct limit_trackable_target
*
* @ingroup sigcfunctors
*/
-template <typename T_functor>
+template<typename T_functor>
struct visitor
{
- template <typename T_action>
+ template<typename T_action>
static void do_visit_each(const T_action& action, const T_functor& functor)
{
action(functor);
@@ -124,7 +127,7 @@ struct visitor
*
* @ingroup sigcfunctors
*/
-template <typename T_action, typename T_functor>
+template<typename T_action, typename T_functor>
void
visit_each(const T_action& action, const T_functor& functor)
{
@@ -146,7 +149,7 @@ visit_each(const T_action& action, const T_functor& functor)
*
* @ingroup sigcfunctors
*/
-template <typename T_action, typename T_functor>
+template<typename T_action, typename T_functor>
void
visit_each_trackable(const T_action& action, const T_functor& functor)
{
diff --git a/sigc++/weak_raw_ptr.h b/sigc++/weak_raw_ptr.h
index 816981c..c065242 100644
--- a/sigc++/weak_raw_ptr.h
+++ b/sigc++/weak_raw_ptr.h
@@ -31,24 +31,20 @@ namespace internal
/** T must derive from sigc::trackable.
*/
-template <typename T>
+template<typename T>
struct weak_raw_ptr : public sigc::notifiable
{
- inline weak_raw_ptr()
- : p_(nullptr)
- {}
+ inline weak_raw_ptr() : p_(nullptr) {}
- inline weak_raw_ptr(T* p) noexcept
- : p_(p)
+ inline weak_raw_ptr(T* p) noexcept : p_(p)
{
- if(!p)
+ if (!p)
return;
p->add_destroy_notify_callback(this, &notify_object_invalidated);
}
- inline weak_raw_ptr(const weak_raw_ptr& src) noexcept
- : p_(src.p_)
+ inline weak_raw_ptr(const weak_raw_ptr& src) noexcept : p_(src.p_)
{
if (p_)
p_->add_destroy_notify_callback(this, &notify_object_invalidated);
@@ -56,38 +52,34 @@ struct weak_raw_ptr : public sigc::notifiable
inline weak_raw_ptr& operator=(const weak_raw_ptr& src) noexcept
{
- if(p_) {
+ if (p_)
+ {
p_->remove_destroy_notify_callback(this);
}
p_ = src.p_;
-
+
if (p_)
p_->add_destroy_notify_callback(this, &notify_object_invalidated);
return *this;
}
- //TODO:
+ // TODO:
weak_raw_ptr(weak_raw_ptr&& src) = delete;
weak_raw_ptr& operator=(weak_raw_ptr&& src) = delete;
inline ~weak_raw_ptr() noexcept
{
- if (p_) {
+ if (p_)
+ {
p_->remove_destroy_notify_callback(this);
}
}
- inline explicit operator bool() const noexcept
- {
- return p_ != nullptr;
- }
+ inline explicit operator bool() const noexcept { return p_ != nullptr; }
- inline T* operator->() const noexcept
- {
- return p_;
- }
+ inline T* operator->() const noexcept { return p_; }
private:
/** Callback that is executed when the objet is destroyed.
@@ -96,7 +88,7 @@ private:
static void notify_object_invalidated(notifiable* data)
{
auto self = static_cast<weak_raw_ptr*>(data);
- if(!self)
+ if (!self)
return;
self->p_ = nullptr;
diff --git a/tests/benchmark.cc b/tests/benchmark.cc
index b640d3b..4f11df7 100644
--- a/tests/benchmark.cc
+++ b/tests/benchmark.cc
@@ -15,14 +15,16 @@ struct foo : public sigc::trackable
int c;
};
-int foo::bar(int a)
+int
+foo::bar(int a)
{
int b = c;
c = a;
return b;
}
-void test_slot_call()
+void
+test_slot_call()
{
foo foobar1;
@@ -33,22 +35,24 @@ void test_slot_call()
std::cout << "elapsed time for calling a slot " << COUNT << " times:" << std::endl;
boost::timer::auto_cpu_timer timer;
- for (int i=0; i < COUNT; ++i)
+ for (int i = 0; i < COUNT; ++i)
slot(i);
}
-void test_signal_emit()
+void
+test_signal_emit()
{
sigc::signal<int(int)> emitter;
std::cout << "elapsed time for " << COUNT << " emissions (0 slots):" << std::endl;
boost::timer::auto_cpu_timer timer;
- for (int i=0; i < COUNT; ++i)
+ for (int i = 0; i < COUNT; ++i)
emitter(i);
}
-void test_connected_signal_emit()
+void
+test_connected_signal_emit()
{
foo foobar1;
sigc::signal<int(int)> emitter;
@@ -57,11 +61,12 @@ void test_connected_signal_emit()
std::cout << "elapsed time for " << COUNT << " emissions (1 slot):" << std::endl;
boost::timer::auto_cpu_timer timer;
- for (int i=0; i < COUNT; ++i)
+ for (int i = 0; i < COUNT; ++i)
emitter(i);
}
-void test_connected_multiple_signal_emit()
+void
+test_connected_multiple_signal_emit()
{
foo foobar1, foobar2, foobar3, foobar4, foobar5;
@@ -74,11 +79,12 @@ void test_connected_multiple_signal_emit()
std::cout << "elapsed time for " << COUNT << " emissions (5 slots):" << std::endl;
boost::timer::auto_cpu_timer timer;
- for (int i=0; i < COUNT; ++i)
+ for (int i = 0; i < COUNT; ++i)
emitter(i);
}
-void test_connect_disconnect()
+void
+test_connect_disconnect()
{
foo foobar1;
sigc::signal<int(int)> emitter;
@@ -87,14 +93,15 @@ void test_connect_disconnect()
std::cout << "elapsed time for " << COUNT << " connections/disconnections:" << std::endl;
boost::timer::auto_cpu_timer timer;
- for (int i=0; i < COUNT; ++i)
- {
- conn = emitter.connect(mem_fun(foobar1, &foo::bar));
- conn.disconnect();
- }
+ for (int i = 0; i < COUNT; ++i)
+ {
+ conn = emitter.connect(mem_fun(foobar1, &foo::bar));
+ conn.disconnect();
+ }
}
-int main()
+int
+main()
{
// slot benchmark ...
test_slot_call();
diff --git a/tests/test_accum_iter.cc b/tests/test_accum_iter.cc
index 948974c..736d73f 100644
--- a/tests/test_accum_iter.cc
+++ b/tests/test_accum_iter.cc
@@ -16,14 +16,13 @@ ident(int i)
return i;
}
-template <typename T>
+template<typename T>
struct min_accum
{
using result_type = T;
- template <typename I>
- decltype(auto)
- operator()(I i1, I i2)
+ template<typename I>
+ decltype(auto) operator()(I i1, I i2)
{
return *std::min_element(i1, i2);
}
diff --git a/tests/test_accumulated.cc b/tests/test_accumulated.cc
index 0a303b9..5ac760b 100644
--- a/tests/test_accumulated.cc
+++ b/tests/test_accumulated.cc
@@ -17,7 +17,7 @@ std::ostringstream result_stream;
struct arithmetic_mean_accumulator
{
using result_type = double;
- template <typename T_iterator>
+ template<typename T_iterator>
double operator()(T_iterator first, T_iterator last) const
{
double value_ = 0;
@@ -28,11 +28,11 @@ struct arithmetic_mean_accumulator
}
};
-template <typename Ret>
+template<typename Ret>
struct vector_accumulator
{
using result_type = std::vector<Ret>;
- template <typename T_iterator>
+ template<typename T_iterator>
result_type operator()(T_iterator first, T_iterator last) const
{
result_type vec;
diff --git a/tests/test_bind.cc b/tests/test_bind.cc
index 80dc9ea..7b228e8 100644
--- a/tests/test_bind.cc
+++ b/tests/test_bind.cc
@@ -121,7 +121,7 @@ main(int argc, char* argv[])
util->check_result(result_stream, "foo_void(int 12)");
// function pointer instead of functor
- sigc::bind (&bar, 13, 14)();
+ sigc::bind(&bar, 13, 14)();
util->check_result(result_stream, "bar(int 13, int 14) ");
// method pointer instead of functor
@@ -138,7 +138,7 @@ main(int argc, char* argv[])
// test references
std::string str("guest book");
- sigc::bind (&egon, std::ref(str))(); // Tell bind that it shall store a reference.
+ sigc::bind(&egon, std::ref(str))(); // Tell bind that it shall store a reference.
result_stream
<< " "
<< str; // (This cannot be the default behaviour: just think about what happens if str dies!)
diff --git a/tests/test_bind_refptr.cc b/tests/test_bind_refptr.cc
index 6840462..48b9d3d 100644
--- a/tests/test_bind_refptr.cc
+++ b/tests/test_bind_refptr.cc
@@ -57,7 +57,7 @@ namespace Glib
* See the "Memory Management" section in the "Programming with gtkmm"
* book for further information.
*/
-template <typename T_CppObject>
+template<typename T_CppObject>
class RefPtr
{
public:
@@ -83,7 +83,7 @@ public:
*
* Increments the reference count.
*/
- template <typename T_CastFrom>
+ template<typename T_CastFrom>
inline explicit RefPtr(const RefPtr<T_CastFrom>& src);
/** Swap the contents of two RefPtr<>.
@@ -100,7 +100,7 @@ public:
*
* Increments the reference count.
*/
- template <typename T_CastFrom>
+ template<typename T_CastFrom>
inline RefPtr<T_CppObject>& operator=(const RefPtr<T_CastFrom>& src);
/// Tests whether the RefPtr<> point to the same underlying instance.
@@ -144,7 +144,7 @@ public:
* ptr_derived = RefPtr<Derived>::cast_dynamic(ptr_base);
* @endcode
*/
- template <typename T_CastFrom>
+ template<typename T_CastFrom>
static inline RefPtr<T_CppObject> cast_dynamic(const RefPtr<T_CastFrom>& src);
/** Static cast to derived class.
@@ -154,7 +154,7 @@ public:
* ptr_derived = RefPtr<Derived>::cast_static(ptr_base);
* @endcode
*/
- template <typename T_CastFrom>
+ template<typename T_CastFrom>
static inline RefPtr<T_CppObject> cast_static(const RefPtr<T_CastFrom>& src);
/** Cast to non-const.
@@ -164,7 +164,7 @@ public:
* ptr_unconst = RefPtr<UnConstType>::cast_const(ptr_const);
* @endcode
*/
- template <typename T_CastFrom>
+ template<typename T_CastFrom>
static inline RefPtr<T_CppObject> cast_const(const RefPtr<T_CastFrom>& src);
/** Compare based on the underlying instance address.
@@ -196,30 +196,30 @@ private:
// RefPtr<>::operator->() comes first here since it's used by other methods.
// If it would come after them it wouldn't be inlined.
-template <typename T_CppObject>
+template<typename T_CppObject>
inline T_CppObject* RefPtr<T_CppObject>::operator->() const
{
return pCppObject_;
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline RefPtr<T_CppObject>::RefPtr() : pCppObject_(nullptr)
{
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline RefPtr<T_CppObject>::~RefPtr()
{
if (pCppObject_)
pCppObject_->unreference(); // This could cause pCppObject to be deleted.
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline RefPtr<T_CppObject>::RefPtr(T_CppObject* pCppObject) : pCppObject_(pCppObject)
{
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CppObject>& src) : pCppObject_(src.pCppObject_)
{
if (pCppObject_)
@@ -229,8 +229,8 @@ inline RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CppObject>& src) : pCppObject_
// The templated ctor allows copy construction from any object that's
// castable. Thus, it does downcasts:
// base_ref = derived_ref
-template <typename T_CppObject>
-template <typename T_CastFrom>
+template<typename T_CppObject>
+template<typename T_CastFrom>
inline RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& src)
: // A different RefPtr<> will not allow us access to pCppObject_. We need
// to add a get_underlying() for this, but that would encourage incorrect
@@ -241,7 +241,7 @@ inline RefPtr<T_CppObject>::RefPtr(const RefPtr<T_CastFrom>& src)
pCppObject_->reference();
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline void
RefPtr<T_CppObject>::swap(RefPtr<T_CppObject>& other)
{
@@ -250,7 +250,7 @@ RefPtr<T_CppObject>::swap(RefPtr<T_CppObject>& other)
other.pCppObject_ = temp;
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline RefPtr<T_CppObject>&
RefPtr<T_CppObject>::operator=(const RefPtr<T_CppObject>& src)
{
@@ -283,8 +283,8 @@ RefPtr<T_CppObject>::operator=(const RefPtr<T_CppObject>& src)
return *this;
}
-template <typename T_CppObject>
-template <typename T_CastFrom>
+template<typename T_CppObject>
+template<typename T_CastFrom>
inline RefPtr<T_CppObject>&
RefPtr<T_CppObject>::operator=(const RefPtr<T_CastFrom>& src)
{
@@ -293,28 +293,28 @@ RefPtr<T_CppObject>::operator=(const RefPtr<T_CastFrom>& src)
return *this;
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline bool
RefPtr<T_CppObject>::operator==(const RefPtr<T_CppObject>& src) const
{
return (pCppObject_ == src.pCppObject_);
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline bool
RefPtr<T_CppObject>::operator!=(const RefPtr<T_CppObject>& src) const
{
return (pCppObject_ != src.pCppObject_);
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline RefPtr<T_CppObject>::operator bool() const
{
return (pCppObject_ != nullptr);
}
#ifndef GLIBMM_DISABLE_DEPRECATED
-template <typename T_CppObject>
+template<typename T_CppObject>
inline void
RefPtr<T_CppObject>::clear()
{
@@ -322,7 +322,7 @@ RefPtr<T_CppObject>::clear()
}
#endif // GLIBMM_DISABLE_DEPRECATED
-template <typename T_CppObject>
+template<typename T_CppObject>
inline void
RefPtr<T_CppObject>::reset()
{
@@ -330,8 +330,8 @@ RefPtr<T_CppObject>::reset()
this->swap(temp);
}
-template <typename T_CppObject>
-template <typename T_CastFrom>
+template<typename T_CppObject>
+template<typename T_CastFrom>
inline RefPtr<T_CppObject>
RefPtr<T_CppObject>::cast_dynamic(const RefPtr<T_CastFrom>& src)
{
@@ -343,8 +343,8 @@ RefPtr<T_CppObject>::cast_dynamic(const RefPtr<T_CastFrom>& src)
return RefPtr<T_CppObject>(pCppObject);
}
-template <typename T_CppObject>
-template <typename T_CastFrom>
+template<typename T_CppObject>
+template<typename T_CastFrom>
inline RefPtr<T_CppObject>
RefPtr<T_CppObject>::cast_static(const RefPtr<T_CastFrom>& src)
{
@@ -356,8 +356,8 @@ RefPtr<T_CppObject>::cast_static(const RefPtr<T_CastFrom>& src)
return RefPtr<T_CppObject>(pCppObject);
}
-template <typename T_CppObject>
-template <typename T_CastFrom>
+template<typename T_CppObject>
+template<typename T_CastFrom>
inline RefPtr<T_CppObject>
RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& src)
{
@@ -369,28 +369,28 @@ RefPtr<T_CppObject>::cast_const(const RefPtr<T_CastFrom>& src)
return RefPtr<T_CppObject>(pCppObject);
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline bool
RefPtr<T_CppObject>::operator<(const RefPtr<T_CppObject>& src) const
{
return (pCppObject_ < src.pCppObject_);
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline bool
RefPtr<T_CppObject>::operator<=(const RefPtr<T_CppObject>& src) const
{
return (pCppObject_ <= src.pCppObject_);
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline bool
RefPtr<T_CppObject>::operator>(const RefPtr<T_CppObject>& src) const
{
return (pCppObject_ > src.pCppObject_);
}
-template <typename T_CppObject>
+template<typename T_CppObject>
inline bool
RefPtr<T_CppObject>::operator>=(const RefPtr<T_CppObject>& src) const
{
@@ -400,7 +400,7 @@ RefPtr<T_CppObject>::operator>=(const RefPtr<T_CppObject>& src) const
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
/** @relates Glib::RefPtr */
-template <typename T_CppObject>
+template<typename T_CppObject>
inline void
swap(RefPtr<T_CppObject>& lhs, RefPtr<T_CppObject>& rhs)
{
diff --git a/tests/test_cpp11_lambda.cc b/tests/test_cpp11_lambda.cc
index 14bee3c..b9e47ca 100644
--- a/tests/test_cpp11_lambda.cc
+++ b/tests/test_cpp11_lambda.cc
@@ -185,7 +185,7 @@ main(int argc, char* argv[])
// std::cout << "((++_1)*2)(ref(a)): " << ((++_1)*2)(std::ref(a));
// std::cout << "; a: " << a << std::endl;
result_stream << ([](std::reference_wrapper<int> x) -> int { return ++x * 2; }(
- std::ref(a_outer)));
+ std::ref(a_outer)));
result_stream << " " << a_outer;
util->check_result(result_stream, "4 2");
result_stream << ([](int& x) -> int { return ++x * 2; }(a_outer));
@@ -201,7 +201,7 @@ main(int argc, char* argv[])
// std::cout << "((--(*(&_1)))*2)(ref(a)): " << ((--(*(&_1)))*2)(std::ref(a));
// std::cout << "; a: " << a << std::endl;
result_stream << ([](std::reference_wrapper<int> x) -> int { return --(*(&x)) * 2; }(
- std::ref(a_outer)));
+ std::ref(a_outer)));
result_stream << " " << a_outer;
util->check_result(result_stream, "6 3");
result_stream << ([](int& x) -> int { return --(*(&x)) * 2; }(a_outer));
@@ -301,8 +301,9 @@ main(int argc, char* argv[])
// std::endl;
// std::ref(the_bar) is not necessary. It can make the call ambiguous.
// Even without std::ref() the_bar is not copied.
- result_stream << std::bind(std::mem_fn(&bar::test), std::placeholders::_1, std::placeholders::_2,
- std::placeholders::_3)(the_bar, 1, 2);
+ result_stream << std::bind(
+ std::mem_fn(&bar::test), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)(
+ the_bar, 1, 2);
util->check_result(result_stream, "bar::test(int 1, int 2) 6");
// same functionality as bind
@@ -370,12 +371,13 @@ main(int argc, char* argv[])
util->check_result(result_stream, "foo(int 1, int 2) 6");
//(sigc::group(sigc::ptr_fun(&foo_void), _2)) (1, 2);
- std::bind (&foo_void, std::placeholders::_2)(1, 2);
+ std::bind(&foo_void, std::placeholders::_2)(1, 2);
util->check_result(result_stream, "foo_void(int 2)");
// same functionality as compose
// std::cout << (sigc::group(&foo, sigc::group(&foo, _1, _2), _3)) (1,2,3) << std::endl;
- result_stream << std::bind(&foo, std::bind(&foo, std::placeholders::_1, std::placeholders::_2),
+ result_stream << std::bind(&foo,
+ std::bind(&foo, std::placeholders::_1, std::placeholders::_2),
std::placeholders::_3)(1, 2, 3);
util->check_result(result_stream, "foo(int 1, int 2) foo(int 6, int 3) 27");
@@ -438,26 +440,26 @@ main(int argc, char* argv[])
// argument binding ...
// sigc::group(&foo,10,sigc::_1)(20); //fixes the first argument and calls foo(10,20)
- std::bind (&foo_group1, 10, std::placeholders::_1)(20);
+ std::bind(&foo_group1, 10, std::placeholders::_1)(20);
util->check_result(result_stream, "foo_group1(int 10, int 20)");
// sigc::group(&foo,sigc::_1,30)(40); //fixes the second argument and calls foo(40,30)
- std::bind (&foo_group1, std::placeholders::_1, 30)(40);
+ std::bind(&foo_group1, std::placeholders::_1, 30)(40);
util->check_result(result_stream, "foo_group1(int 40, int 30)");
// argument reordering ...
// sigc::group(&foo,sigc::_2,sigc::_1)(1,2); //calls foo(2,1)
- std::bind (&foo_group1, std::placeholders::_2, std::placeholders::_1)(1, 2);
+ std::bind(&foo_group1, std::placeholders::_2, std::placeholders::_1)(1, 2);
util->check_result(result_stream, "foo_group1(int 2, int 1)");
// argument hiding ...
// sigc::group(&foo,sigc::_1,sigc::_2)(1,2,3); //calls foo(1,2)
- std::bind (&foo_group1, std::placeholders::_1, std::placeholders::_2)(1, 2, 3);
+ std::bind(&foo_group1, std::placeholders::_1, std::placeholders::_2)(1, 2, 3);
util->check_result(result_stream, "foo_group1(int 1, int 2)");
// functor composition ...
// sigc::group(&foo,sigc::_1,sigc::group(&bar,sigc::_2))(1,2); //calls foo(1,bar(2))
- std::bind (&foo_group1, std::placeholders::_1, std::bind(&bar_group1, std::placeholders::_2))(
+ std::bind(&foo_group1, std::placeholders::_1, std::bind(&bar_group1, std::placeholders::_2))(
1, 2);
util->check_result(result_stream, "bar_group1(int 2) foo_group1(int 1, int 4)");
diff --git a/tests/test_disconnect.cc b/tests/test_disconnect.cc
index 4cbf3c9..28ff1e3 100644
--- a/tests/test_disconnect.cc
+++ b/tests/test_disconnect.cc
@@ -159,7 +159,7 @@ main(int argc, char* argv[])
util->check_result(result_stream, "sig is empty (size=0): ");
result_stream << "deleting a signal during emission... ";
- auto b = new B; //This is deleted by B::destroy().
+ auto b = new B; // This is deleted by B::destroy().
b->emit();
util->check_result(result_stream, "deleting a signal during emission... Good bye world!");
diff --git a/tests/test_limit_reference.cc b/tests/test_limit_reference.cc
index 70caae8..5a7a8aa 100644
--- a/tests/test_limit_reference.cc
+++ b/tests/test_limit_reference.cc
@@ -19,7 +19,9 @@ public:
virtual ~Base2() {}
};
-class Derived : virtual public Base, public Base2
+class Derived
+: virtual public Base
+, public Base2
{
public:
void method() { result_stream << "method()"; }
diff --git a/tests/test_mem_fun.cc b/tests/test_mem_fun.cc
index 202511f..dc21937 100644
--- a/tests/test_mem_fun.cc
+++ b/tests/test_mem_fun.cc
@@ -49,42 +49,48 @@ struct test
} // end anonymous namespace
-void test_non_const()
+void
+test_non_const()
{
test t;
sigc::mem_fun (&test::foo)(t, 1);
util->check_result(result_stream, "test::foo(short 1)");
}
-void test_const()
+void
+test_const()
{
test t;
sigc::mem_fun (&test::foo_const)(t, 2);
util->check_result(result_stream, "test::foo_const(int 2)");
}
-void test_const_with_const_object()
+void
+test_const_with_const_object()
{
const auto t = test();
sigc::mem_fun (&test::foo_const)(t, 3);
util->check_result(result_stream, "test::foo_const(int 3)");
}
-void test_non_const_volatile()
+void
+test_non_const_volatile()
{
test t;
sigc::mem_fun (&test::foo_volatile)(t, 4);
util->check_result(result_stream, "test::foo_volatile(float 4)");
}
-void test_const_volatile()
+void
+test_const_volatile()
{
test t;
sigc::mem_fun (&test::foo_const_volatile)(t, 5);
util->check_result(result_stream, "test::foo_const_volatile(double 5)");
}
-void test_const_volatile_with_const_object()
+void
+test_const_volatile_with_const_object()
{
const auto t = test();
sigc::mem_fun (&test::foo_const_volatile)(t, 6);
@@ -92,7 +98,8 @@ void test_const_volatile_with_const_object()
}
#if ENABLE_TEST_OF_OVERLOADED_FUNCTIONS
-void test_overloaded()
+void
+test_overloaded()
{
test t;
sigc::mem_fun<char> (&test::foo_overloaded)(t, 7);
@@ -109,7 +116,8 @@ void test_overloaded()
}
#endif
-void test_bound()
+void
+test_bound()
{
test t;
sigc::mem_fun(t, &test::foo)(9);
@@ -142,27 +150,25 @@ void test_bound()
class TestAutoDisconnect : public sigc::trackable
{
public:
- void foo()
- {
- result_stream << "TestAutoDisconnect::foo() called.";
- }
+ void foo() { result_stream << "TestAutoDisconnect::foo() called."; }
};
-void test_auto_disconnect()
+void
+test_auto_disconnect()
{
- //Check that slot doesn't try to call a method on a destroyed instance,
- //when the instance's class derives from trackable.
+ // Check that slot doesn't try to call a method on a destroyed instance,
+ // when the instance's class derives from trackable.
sigc::slot<void()> slot_of_member_method;
{
TestAutoDisconnect t;
slot_of_member_method = sigc::mem_fun(t, &TestAutoDisconnect::foo);
- //The method should be called:
+ // The method should be called:
slot_of_member_method();
util->check_result(result_stream, "TestAutoDisconnect::foo() called.");
}
- //The method should not be called:
+ // The method should not be called:
slot_of_member_method();
util->check_result(result_stream, "");
}
diff --git a/tests/test_signal.cc b/tests/test_signal.cc
index 4ea7c11..b5fdaf2 100644
--- a/tests/test_signal.cc
+++ b/tests/test_signal.cc
@@ -117,7 +117,10 @@ test_clear_called_in_signal_handler()
{
sigc::signal<void()> sig;
sig.connect([]() { result_stream << ", slot 1, "; });
- sig.connect([&sig]() { sig.clear(); result_stream << "slot 2, "; });
+ sig.connect([&sig]() {
+ sig.clear();
+ result_stream << "slot 2, ";
+ });
sig.connect([]() { result_stream << "slot 3, "; });
result_stream << sig.size();
sig.emit();
diff --git a/tests/test_size.cc b/tests/test_size.cc
index cf94a8b..4b09a25 100644
--- a/tests/test_size.cc
+++ b/tests/test_size.cc
@@ -31,47 +31,46 @@ main(int argc, char* argv[])
{
std::cout << "sizes of public classes:" << std::endl;
- //libsigc++ 2.10: 8
- //libsigc++ 3.0: 8
+ // libsigc++ 2.10: 8
+ // libsigc++ 3.0: 8
std::cout << " trackable: " << sizeof(sigc::trackable) << std::endl;
- //libsigc++ 2.10: 16
- //libsigc++ 3.0: 16
+ // libsigc++ 2.10: 16
+ // libsigc++ 3.0: 16
std::cout << " slot<void()>: " << sizeof(sigc::slot<void()>) << std::endl;
- //libsigc++ 2.10: 16
- //libsigc++ 3.0: 16
+ // libsigc++ 2.10: 16
+ // libsigc++ 3.0: 16
std::cout << " signal<void()>: " << sizeof(sigc::signal<void()>) << std::endl;
- //libsigc++ 2.10: 8
- //libsigc++ 3.0: 8
+ // libsigc++ 2.10: 8
+ // libsigc++ 3.0: 8
std::cout << " connection: " << sizeof(sigc::connection) << std::endl;
-
std::cout << std::endl << "sizes of internal classes:" << std::endl;
- //libsigc++ 2.10: 16
- //libsigc++ 3.0: 16
+ // libsigc++ 2.10: 16
+ // libsigc++ 3.0: 16
std::cout << " trackable_callback: " << sizeof(sigc::internal::trackable_callback)
<< std::endl;
- //libsigc++ 2.10: 32
- //libsigc++ 3.0: 32
+ // libsigc++ 2.10: 32
+ // libsigc++ 3.0: 32
std::cout << " trackable_callback_list: " << sizeof(sigc::internal::trackable_callback_list)
<< std::endl;
- //libsigc++ 2.10: 48
- //libsigc++ 3.0: 48
+ // libsigc++ 2.10: 48
+ // libsigc++ 3.0: 48
std::cout << " slot_rep: " << sizeof(sigc::internal::slot_rep) << std::endl;
- //libsigc++ 2.10: 72
- //libsigc++ 3.0: 64
+ // libsigc++ 2.10: 72
+ // libsigc++ 3.0: 64
std::cout << " typed_slot_rep<mem_functor<void,A> >: "
<< sizeof(sigc::internal::typed_slot_rep<sigc::mem_functor<void (A::*)()>>)
<< std::endl;
- //libsigc++ 2.10: 32
- //libsigc++ 3.0: 32
+ // libsigc++ 2.10: 32
+ // libsigc++ 3.0: 32
std::cout << " signal_impl: " << sizeof(sigc::internal::signal_impl) << std::endl;
}
return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/test_track_obj.cc b/tests/test_track_obj.cc
index 594d9cf..dcbd222 100644
--- a/tests/test_track_obj.cc
+++ b/tests/test_track_obj.cc
@@ -81,6 +81,7 @@ public:
protected:
// Don't make it private. clang++ does not like unused private data.
const bar_group4& bar_;
+
private:
const book& aBook_;
};
diff --git a/tests/test_trackable_move.cc b/tests/test_trackable_move.cc
index daf80ce..05a14b4 100644
--- a/tests/test_trackable_move.cc
+++ b/tests/test_trackable_move.cc
@@ -18,8 +18,8 @@ public:
my_class(const my_class& src) = delete;
my_class& operator=(const my_class& src) = delete;
- my_class(my_class&& src) noexcept
- : sigc::trackable(std::move(src)), i(std::move(src.i)) {
+ my_class(my_class&& src) noexcept : sigc::trackable(std::move(src)), i(std::move(src.i))
+ {
src.i = 0;
}
diff --git a/tests/test_tuple_for_each.cc b/tests/test_tuple_for_each.cc
index c4d11a4..03abb17 100644
--- a/tests/test_tuple_for_each.cc
+++ b/tests/test_tuple_for_each.cc
@@ -21,7 +21,7 @@
#include <functional>
#include <string>
-template <typename T_element_from>
+template<typename T_element_from>
class for_each_simple
{
public:
@@ -45,7 +45,7 @@ test_tuple_for_each_same_types()
}
}
-template <typename T_element_from>
+template<typename T_element_from>
class for_each_simple_with_extras
{
public:
@@ -65,7 +65,7 @@ test_tuple_for_each_same_types_with_extras()
}
}
-template <typename T_element_from>
+template<typename T_element_from>
class for_each_simple_with_nonconst_extras
{
public:
@@ -88,11 +88,11 @@ test_tuple_for_each_same_types_with_nonconst_extras()
// The general template declaration.
// We then provide specializations for each type,
// so we can test having a different return value for each T_element_from type.
-template <typename T_element_from>
+template<typename T_element_from>
class visitor_with_specializations;
// An int will be converted to a std::string:
-template <>
+template<>
class visitor_with_specializations<int>
{
public:
@@ -103,7 +103,7 @@ public:
};
// A double will be converted to a char:
-template <>
+template<>
class visitor_with_specializations<double>
{
public:
@@ -114,7 +114,7 @@ public:
};
// A std::string will be converted to an int:
-template <>
+template<>
class visitor_with_specializations<std::string>
{
public:
@@ -125,7 +125,7 @@ public:
};
// A const char* will be converted to an int:
-template <>
+template<>
class visitor_with_specializations<const char*>
{
public:
@@ -142,7 +142,7 @@ test_tuple_for_each_multiple_types()
sigc::internal::tuple_for_each<visitor_with_specializations>(t_original);
}
-template <typename T_element_from>
+template<typename T_element_from>
class for_each_nonconst
{
public:
@@ -189,7 +189,7 @@ test_tuple_for_each_stdref()
static std::string correct_sequence_output;
-template <typename T_element_from>
+template<typename T_element_from>
class for_each_correct_sequence
{
public:
diff --git a/tests/test_tuple_transform_each.cc b/tests/test_tuple_transform_each.cc
index 1714bb4..ded7602 100644
--- a/tests/test_tuple_transform_each.cc
+++ b/tests/test_tuple_transform_each.cc
@@ -21,7 +21,7 @@
#include <functional>
#include <string>
-template <typename T_element_from>
+template<typename T_element_from>
class transform_to_string
{
public:
@@ -68,11 +68,11 @@ test_tuple_transform_each_same_types()
// The general template declaration.
// We then provide specializations for each type,
// so we can test having a different return value for each T_element_from type.
-template <typename T_element_from>
+template<typename T_element_from>
class transform_to_something;
// An int will be converted to a std::string:
-template <>
+template<>
class transform_to_something<int>
{
public:
@@ -80,7 +80,7 @@ public:
};
// A double will be converted to a char:
-template <>
+template<>
class transform_to_something<double>
{
public:
@@ -88,7 +88,7 @@ public:
};
// A std::string will be converted to an int:
-template <>
+template<>
class transform_to_something<std::string>
{
public:
@@ -114,7 +114,7 @@ test_tuple_transform_each_multiple_types()
"unexpected transform_each()ed tuple type");
}
-template <typename T_element_from>
+template<typename T_element_from>
class transform_each_nonconst
{
public:
@@ -184,7 +184,7 @@ private:
int m_val;
};
-template <typename T_element_from>
+template<typename T_element_from>
class transform_noncopyable_to_string
{
public:
@@ -215,7 +215,7 @@ test_tuple_transform_each_stdref_non_copyable()
static std::string correct_sequence_output;
-template <typename T_element_from>
+template<typename T_element_from>
class transform_each_correct_sequence
{
public:
@@ -246,11 +246,11 @@ test_tuple_transform_each_empty_tuple()
// The general template declaration.
// We then provide specializations for each type,
// so we can test having a different return value for each T_element_from type.
-template <typename T_element_from>
+template<typename T_element_from>
class transform_as_constexpr_to_something;
// An int will be converted to a char:
-template <>
+template<>
class transform_as_constexpr_to_something<int>
{
public:
@@ -258,7 +258,7 @@ public:
};
// A double will be converted to an int:
-template <>
+template<>
class transform_as_constexpr_to_something<const double>
{
public:
diff --git a/tests/test_visit_each.cc b/tests/test_visit_each.cc
index 2c74898..adb59da 100644
--- a/tests/test_visit_each.cc
+++ b/tests/test_visit_each.cc
@@ -42,7 +42,7 @@ class NsExtClass
{
};
-template <typename T_action, typename T_functor>
+template<typename T_action, typename T_functor>
void
visit_each(T_action&, const T_functor&)
{
@@ -59,16 +59,20 @@ public:
explicit MyClass1(const std::string& str) : s(str) {}
void execute(int i) { result_stream << s << i; }
+
private:
std::string s;
};
-class MyClass2 : public ns_ext::NsExtClass, public sigc::trackable
+class MyClass2
+: public ns_ext::NsExtClass
+, public sigc::trackable
{
public:
explicit MyClass2(const std::string& str) : s(str) {}
void execute(int i) { result_stream << s << i; }
+
private:
std::string s;
};
@@ -78,7 +82,7 @@ private:
namespace ns1
{
// User-defined adaptor, as decribed in adaptor_trait.h.
-template <typename T_functor>
+template<typename T_functor>
struct MyAdaptor1 : public sigc::adapts<T_functor>
{
decltype(auto) operator()() const
@@ -87,14 +91,14 @@ struct MyAdaptor1 : public sigc::adapts<T_functor>
return this->functor_();
}
- template <typename T_arg1>
+ template<typename T_arg1>
decltype(auto) operator()(T_arg1 arg1) const
{
result_stream << "MyAdaptor1()(arg1) ";
return this->functor_(arg1);
}
- template <typename T_arg1, typename T_arg2>
+ template<typename T_arg1, typename T_arg2>
decltype(auto) operator()(T_arg1 arg1, T_arg2 arg2) const
{
result_stream << "MyAdaptor1()(arg1, arg2) ";
@@ -106,14 +110,14 @@ struct MyAdaptor1 : public sigc::adapts<T_functor>
explicit MyAdaptor1(const T_functor& functor) : sigc::adapts<T_functor>(functor) {}
};
-template <typename T_action, typename T_functor>
+template<typename T_action, typename T_functor>
void
visit_each(const T_action& action, const MyAdaptor1<T_functor>& target)
{
visit_each(action, target.functor_);
}
-template <typename T_functor>
+template<typename T_functor>
inline MyAdaptor1<T_functor>
my_adaptor1(const T_functor& func)
{
@@ -126,10 +130,10 @@ my_adaptor1(const T_functor& func)
// Specialization of sigc::visitor for MyAdaptor1.
namespace sigc
{
-template <typename T_functor>
+template<typename T_functor>
struct visitor<ns1::MyAdaptor1<T_functor>>
{
- template <typename T_action>
+ template<typename T_action>
static void do_visit_each(const T_action& action, const ns1::MyAdaptor1<T_functor>& target)
{
sigc::visit_each(action, target.functor_);
diff --git a/tests/test_visit_each_trackable.cc b/tests/test_visit_each_trackable.cc
index d553424..720fcfb 100644
--- a/tests/test_visit_each_trackable.cc
+++ b/tests/test_visit_each_trackable.cc
@@ -22,16 +22,16 @@ struct A : public sigc::trackable
A() {}
};
-template <typename T_type, bool I_derived = std::is_base_of<sigc::trackable, T_type>::value>
+template<typename T_type, bool I_derived = std::is_base_of<sigc::trackable, T_type>::value>
struct with_trackable;
-template <typename T_type>
+template<typename T_type>
struct with_trackable<T_type, false>
{
static void perform(const T_type&) { result_stream << "other "; }
};
-template <typename T_type>
+template<typename T_type>
struct with_trackable<T_type, true>
{
static void perform(const T_type&) { result_stream << "trackable "; }
@@ -45,7 +45,7 @@ struct print
{
void operator()(int i) const { result_stream << "int: " << i << " "; }
- template <typename T>
+ template<typename T>
void operator()(const T& t) const
{
with_trackable<T>::perform(t);
@@ -64,7 +64,8 @@ bar(int)
} // end anonymous namespace
-void test_hit_all_targets()
+void
+test_hit_all_targets()
{
int i = 1;
A a;
@@ -74,7 +75,8 @@ void test_hit_all_targets()
util->check_result(result_stream, "hit all targets: other trackable int: 1 other ");
}
-void test_hit_all_trackable()
+void
+test_hit_all_trackable()
{
int i = 3;
A a;
diff --git a/tests/test_weak_raw_ptr.cc b/tests/test_weak_raw_ptr.cc
index 82a159a..c6ffc38 100644
--- a/tests/test_weak_raw_ptr.cc
+++ b/tests/test_weak_raw_ptr.cc
@@ -15,46 +15,45 @@ std::ostringstream result_stream;
class A : public sigc::trackable
{
public:
- void something()
- {
- result_stream << "method called";
- }
+ void something() { result_stream << "method called"; }
};
} // end anonymous namespace
-void test_weak_ptr_becomes_null()
+void
+test_weak_ptr_becomes_null()
{
const auto a = new A();
sigc::internal::weak_raw_ptr<A> raw_ptr(a);
assert(raw_ptr);
- //Call something on A, via the weak_raw_ptr<>,
- //just to make sure that it doesn't get optimised away:
+ // Call something on A, via the weak_raw_ptr<>,
+ // just to make sure that it doesn't get optimised away:
raw_ptr->something();
util->check_result(result_stream, "method called");
delete a;
- //Deleting the A should have made the weak_raw_ptr<A> become invalid.
+ // Deleting the A should have made the weak_raw_ptr<A> become invalid.
assert(!raw_ptr);
}
-void test_weak_ptr_disconnects_self()
+void
+test_weak_ptr_disconnects_self()
{
const auto a = new A();
{
sigc::internal::weak_raw_ptr<A> raw_ptr(a);
- //Call something on A, via the weak_raw_ptr<>,
- //just to make sure that it doesn't get optimised away:
+ // Call something on A, via the weak_raw_ptr<>,
+ // just to make sure that it doesn't get optimised away:
raw_ptr->something();
util->check_result(result_stream, "method called");
}
- //If the weak_raw_ptr has not asked A to stop notifying it,
- //then we would expect some undefined behaviour here,
- //when a tries to notify the now-destroyed weak_raw_ptr.
+ // If the weak_raw_ptr has not asked A to stop notifying it,
+ // then we would expect some undefined behaviour here,
+ // when a tries to notify the now-destroyed weak_raw_ptr.
delete a;
}
diff --git a/tests/testutilities.cc b/tests/testutilities.cc
index a34f2ab..ae9e11c 100644
--- a/tests/testutilities.cc
+++ b/tests/testutilities.cc
@@ -23,9 +23,7 @@
TestUtilities* TestUtilities::instance_ = nullptr;
-TestUtilities::TestUtilities() : verbose_(false), result_ok_(true), test_number_(0)
-{
-}
+TestUtilities::TestUtilities() : verbose_(false), result_ok_(true), test_number_(0) {}
// static
TestUtilities*