[libsigcplusplus] Reformat .h files with clang-format.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus] Reformat .h files with clang-format.
- Date: Wed, 30 Mar 2016 14:09:33 +0000 (UTC)
commit 7fa1c252e8562f3581087c6df64b334198f6b27d
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Mar 30 16:06:05 2016 +0200
Reformat .h files with clang-format.
sigc++/adaptors/adaptor_base.h | 9 +-
sigc++/adaptors/adaptor_trait.h | 51 +-
sigc++/adaptors/bind.h | 158 +++---
sigc++/adaptors/bind_return.h | 45 +-
sigc++/adaptors/bound_argument.h | 51 +-
sigc++/adaptors/compose.h | 86 ++--
sigc++/adaptors/exception_catch.h | 88 ++--
sigc++/adaptors/hide.h | 76 ++--
sigc++/adaptors/retype.h | 57 ++-
sigc++/adaptors/retype_return.h | 75 ++--
sigc++/adaptors/track_obj.h | 44 +-
sigc++/bind_return.h | 1 -
sigc++/connection.h | 14 +-
sigc++/functors/functor_base.h | 8 +-
sigc++/functors/functor_trait.h | 66 ++--
sigc++/functors/mem_fun.h | 121 ++---
sigc++/functors/ptr_fun.h | 22 +-
sigc++/functors/slot.h | 126 +++---
sigc++/functors/slot_base.h | 67 ++-
sigc++/limit_reference.h | 42 +-
sigc++/member_method_trait.h | 30 +-
sigc++/reference_wrapper.h | 21 +-
sigc++/retype_return.h | 1 -
sigc++/sigc++.h | 22 +-
sigc++/signal.h | 816 ++++++++++++++---------------
sigc++/signal_base.h | 58 +-
sigc++/trackable.h | 31 +-
sigc++/tuple-utils/tuple_cdr.h | 22 +-
sigc++/tuple-utils/tuple_end.h | 52 +-
sigc++/tuple-utils/tuple_for_each.h | 62 ++--
sigc++/tuple-utils/tuple_start.h | 39 +-
sigc++/tuple-utils/tuple_transform_each.h | 69 ++--
sigc++/type_traits.h | 10 +-
sigc++/visit_each.h | 95 ++--
tests/testutilities.h | 3 -
35 files changed, 1274 insertions(+), 1264 deletions(-)
---
diff --git a/sigc++/adaptors/adaptor_base.h b/sigc++/adaptors/adaptor_base.h
index 8fda1e4..92a7b8a 100644
--- a/sigc++/adaptors/adaptor_base.h
+++ b/sigc++/adaptors/adaptor_base.h
@@ -1,9 +1,10 @@
#ifndef _SIGC_ADAPTORS_DEDUCE_RESULT_TYPE_H_
#define _SIGC_ADAPTORS_DEDUCE_RESULT_TYPE_H_
-namespace sigc {
+namespace sigc
+{
-//TODO: Is this necessary now that we don't need deduce_result_type?
+// TODO: Is this necessary now that we don't need deduce_result_type?
/** A hint to the compiler.
* Functors which have all methods based on templates
* should publicly inherit from this hint.
@@ -18,7 +19,9 @@ namespace sigc {
*
* @ingroup adaptors
*/
-struct adaptor_base : public functor_base {};
+struct adaptor_base : public functor_base
+{
+};
} /* namespace sigc */
#endif /* _SIGC_ADAPTORS_DEDUCE_RESULT_TYPE_H_ */
diff --git a/sigc++/adaptors/adaptor_trait.h b/sigc++/adaptors/adaptor_trait.h
index 2c1640d..c6e77a4 100644
--- a/sigc++/adaptors/adaptor_trait.h
+++ b/sigc++/adaptors/adaptor_trait.h
@@ -30,11 +30,13 @@
* via the callof<> template - a tricky way to detect the return
* type of a functor when the argument types are known. Martin.
*/
-
-namespace sigc {
+
+namespace sigc
+{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-template <class T_functor> struct adapts;
+template <class T_functor>
+struct adapts;
#endif
/** @defgroup adaptors Adaptors
@@ -73,45 +75,41 @@ struct adaptor_functor : public adaptor_base
/** Invokes the wrapped functor passing on the arguments.
* @return The return value of the functor invocation.
*/
- decltype(auto)
- operator()() const
- { return functor_(); }
+ decltype(auto) operator()() const { return functor_(); }
/** Invokes the wrapped functor passing on the arguments.
* @param _A_arg... Arguments to be passed on to the functor.
* @return The return value of the functor invocation.
*/
template <class... T_arg>
- decltype(auto)
- operator()(T_arg&&... _A_arg) const
- { return functor_(std::forward<T_arg>(_A_arg)...); }
+ decltype(auto) operator()(T_arg&&... _A_arg) const
+ {
+ return functor_(std::forward<T_arg>(_A_arg)...);
+ }
/// Constructs an invalid functor.
- adaptor_functor()
- {}
+ adaptor_functor() {}
/** Constructs an adaptor_functor object that wraps the passed functor.
* @param _A_functor Functor to invoke from operator()().
*/
- explicit adaptor_functor(const T_functor& _A_functor)
- : functor_(_A_functor)
- {}
+ explicit adaptor_functor(const T_functor& _A_functor) : functor_(_A_functor) {}
/** Constructs an adaptor_functor object that wraps the passed (member)
* function pointer.
* @param _A_type Pointer to function or class method to invoke from operator()().
*/
template <class T_type>
- explicit adaptor_functor(const T_type& _A_type)
- : functor_(_A_type)
- {}
+ explicit adaptor_functor(const T_type& _A_type) : functor_(_A_type)
+ {
+ }
/// Functor that is invoked from operator()().
mutable T_functor functor_;
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::adaptor_functor performs a functor
* on the functor stored in the sigc::adaptor_functor object.
@@ -119,11 +117,10 @@ struct adaptor_functor : public adaptor_base
* @ingroup adaptors
*/
template <class T_functor>
-struct visitor<adaptor_functor<T_functor> >
+struct visitor<adaptor_functor<T_functor>>
{
template <class T_action>
- static void do_visit_each(const T_action& _A_action,
- const adaptor_functor<T_functor>& _A_target)
+ static void do_visit_each(const T_action& _A_action, const adaptor_functor<T_functor>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
}
@@ -140,9 +137,13 @@ struct visitor<adaptor_functor<T_functor> >
* @ingroup adaptors
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-template <class T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_functor>::value> struct
adaptor_trait;
+template <class T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_functor>::value>
+struct adaptor_trait;
#else
-template <class T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_functor>::value> struct
adaptor_trait {};
+template <class T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_functor>::value>
+struct adaptor_trait
+{
+};
#endif
/** Trait that specifies what is the adaptor version of a functor type.
@@ -243,9 +244,7 @@ struct adapts : public adaptor_base
/** Constructs an adaptor that wraps the passed functor.
* @param _A_functor Functor to invoke from operator()().
*/
- explicit adapts(const T_functor& _A_functor)
- : functor_(_A_functor)
- {}
+ explicit adapts(const T_functor& _A_functor) : functor_(_A_functor) {}
/// Adaptor that is invoked from operator()().
mutable adaptor_type functor_;
diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h
index 459b884..2365526 100644
--- a/sigc++/adaptors/bind.h
+++ b/sigc++/adaptors/bind.h
@@ -8,15 +8,16 @@
#include <sigc++/tuple-utils/tuple_end.h>
#include <sigc++/tuple-utils/tuple_transform_each.h>
-namespace sigc {
-
+namespace sigc
+{
/** @defgroup bind bind(), bind_return()
* sigc::bind() alters an arbitrary functor by fixing arguments to certain values.
* Up to 7 arguments can be bound at a time.
* For single argument binding, overloads of sigc::bind() are provided that let you
* specify the zero-based position of the argument to fix with the first template parameter.
- * (A value of @p -1 fixes the last argument so sigc::bind<-1>() gives the same result as sigc::bind().)
+ * (A value of @p -1 fixes the last argument so sigc::bind<-1>() gives the same result as
+ * sigc::bind().)
* The types of the arguments can optionally be specified if not deduced.
*
* @par Examples:
@@ -85,17 +86,12 @@ namespace internal
template <class T_element>
struct TransformEachInvoker
{
- //We take T_element as non-const because invoke() is not const.
- //TODO: Take element as T_element&& ?
- constexpr
- static
- decltype(auto)
- transform(T_element& element) {
- return element.invoke();
- }
+ // We take T_element as non-const because invoke() is not const.
+ // TODO: Take element as T_element&& ?
+ constexpr static decltype(auto) transform(T_element& element) { return element.invoke(); }
};
-} //namespace internal
+} // namespace internal
/** Adaptor that binds arguments to the wrapped functor.
* Use the convenience function sigc::bind() to create an instance of sigc::bind_functor.
@@ -119,51 +115,49 @@ struct bind_functor : public adapts<T_functor>
* @return The return value of the functor invocation.
*/
template <class... T_arg>
- decltype(auto)
- operator()(T_arg&&... _A_arg)
- {
- //For instance, if I_location is 1, and _A_arg has 4 arguments,
- //we would want to call operator() with (_A_arg0, bound, _A_arg1, _A_arg2).
-
- using tuple_type_args = std::tuple<type_trait_pass_t<T_arg>...>;
- const auto t_args = std::tuple<T_arg...>(std::forward<T_arg>(_A_arg)...);
- constexpr auto t_args_size = std::tuple_size<tuple_type_args>::value;
-
- //Prevent calling tuple_start<> with values that will cause a compilation error.
- static_assert(I_location <= t_args_size,
- "I_location must be less than or equal to the number of arguments.");
-
- const auto t_start = internal::tuple_start<I_location>(t_args);
- const auto t_bound = internal::tuple_transform_each<internal::TransformEachInvoker>(bound_);
- const auto t_end = internal::tuple_end<t_args_size - I_location>(t_args);
- const auto t_with_bound = std::tuple_cat(t_start, t_bound, t_end);
-
- constexpr const auto seq = std::make_index_sequence<std::tuple_size<decltype(t_with_bound)>::value>();
- return call_functor_operator_parentheses(t_with_bound, seq);
- }
+ decltype(auto) operator()(T_arg&&... _A_arg)
+ {
+ // For instance, if I_location is 1, and _A_arg has 4 arguments,
+ // we would want to call operator() with (_A_arg0, bound, _A_arg1, _A_arg2).
+
+ using tuple_type_args = std::tuple<type_trait_pass_t<T_arg>...>;
+ const auto t_args = std::tuple<T_arg...>(std::forward<T_arg>(_A_arg)...);
+ constexpr auto t_args_size = std::tuple_size<tuple_type_args>::value;
+
+ // Prevent calling tuple_start<> with values that will cause a compilation error.
+ static_assert(I_location <= t_args_size,
+ "I_location must be less than or equal to the number of arguments.");
+
+ const auto t_start = internal::tuple_start<I_location>(t_args);
+ const auto t_bound = internal::tuple_transform_each<internal::TransformEachInvoker>(bound_);
+ const auto t_end = internal::tuple_end<t_args_size - I_location>(t_args);
+ const auto t_with_bound = std::tuple_cat(t_start, t_bound, t_end);
+
+ constexpr const auto seq =
+ std::make_index_sequence<std::tuple_size<decltype(t_with_bound)>::value>();
+ return call_functor_operator_parentheses(t_with_bound, seq);
+ }
/** Constructs a bind_functor object that binds an argument to the passed functor.
* @param _A_func Functor to invoke from operator()().
* @param _A_bound Argument to bind to the functor.
*/
bind_functor(type_trait_take_t<T_functor> _A_func, type_trait_take_t<T_bound>... _A_bound)
- : adapts<T_functor>(_A_func), bound_(_A_bound...)
- {}
+ : adapts<T_functor>(_A_func), bound_(_A_bound...)
+ {
+ }
private:
/// The arguments bound to the functor.
std::tuple<bound_argument<T_bound>...> bound_;
- template<class T, std::size_t... Is>
- decltype(auto)
- call_functor_operator_parentheses(T&& tuple,
- std::index_sequence<Is...>)
+ template <class T, std::size_t... Is>
+ decltype(auto) call_functor_operator_parentheses(T&& tuple, std::index_sequence<Is...>)
{
return (this->functor_)(std::get<Is>(std::forward<T>(tuple))...);
}
};
-
/** Adaptor that binds argument(s) to the wrapped functor.
* This template specialization fixes the last argument(s) of the wrapped functor.
*
@@ -181,62 +175,57 @@ struct bind_functor<-1, T_functor, T_type...> : public adapts<T_functor>
* @return The return value of the functor invocation.
*/
template <class... T_arg>
- decltype(auto)
- operator()(T_arg&&... _A_arg)
- {
- //For instance, if _A_arg has 4 arguments,
- //we would want to call operator() with (_A_arg0, _A_arg1, _A_arg2, bound).
-
- const auto t_args = std::tuple<T_arg...>(std::forward<T_arg>(_A_arg)...);
- const auto t_bound = internal::tuple_transform_each<internal::TransformEachInvoker>(bound_);
- const auto t_with_bound = std::tuple_cat(t_args, t_bound);
-
- constexpr auto seq = std::make_index_sequence<std::tuple_size<decltype(t_with_bound)>::value>();
- return call_functor_operator_parentheses(t_with_bound, seq);
- }
+ decltype(auto) operator()(T_arg&&... _A_arg)
+ {
+ // For instance, if _A_arg has 4 arguments,
+ // we would want to call operator() with (_A_arg0, _A_arg1, _A_arg2, bound).
+
+ const auto t_args = std::tuple<T_arg...>(std::forward<T_arg>(_A_arg)...);
+ const auto t_bound = internal::tuple_transform_each<internal::TransformEachInvoker>(bound_);
+ const auto t_with_bound = std::tuple_cat(t_args, t_bound);
+
+ constexpr auto seq = std::make_index_sequence<std::tuple_size<decltype(t_with_bound)>::value>();
+ return call_functor_operator_parentheses(t_with_bound, seq);
+ }
/** Constructs a bind_functor object that binds an argument to the passed functor.
* @param _A_func Functor to invoke from operator()().
* @param _A_bound Arguments to bind to the functor.
*/
bind_functor(type_trait_take_t<T_functor> _A_func, type_trait_take_t<T_type>... _A_bound)
- : adapts<T_functor>(_A_func), bound_(_A_bound...)
- {}
+ : adapts<T_functor>(_A_func), bound_(_A_bound...)
+ {
+ }
/// The argument bound to the functor.
std::tuple<bound_argument<T_type>...> bound_;
private:
- template<class T, std::size_t... Is>
- decltype(auto)
- call_functor_operator_parentheses(T&& tuple,
- std::index_sequence<Is...>)
+ template <class T, std::size_t... Is>
+ decltype(auto) call_functor_operator_parentheses(T&& tuple, std::index_sequence<Is...>)
{
return (this->functor_)(std::get<Is>(std::forward<T>(tuple))...);
}
};
+namespace
+{
-namespace {
-
-//TODO: Avoid duplication with TrackObjVisitForEach in track_obj.h
-template<typename T_element>
+// TODO: Avoid duplication with TrackObjVisitForEach in track_obj.h
+template <typename T_element>
struct TupleVisitorVisitEach
{
- template<typename T_action>
- constexpr
- static
- void
- visit(const T_element& element, const T_action& action)
+ template <typename T_action>
+ constexpr static void visit(const T_element& element, const T_action& action)
{
sigc::visit_each(action, element);
}
};
-} //anonymous namespace
+} // anonymous namespace
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::bind_functor performs a functor on the
* functor and on the object instances stored in the sigc::bind_functor object.
@@ -244,18 +233,18 @@ struct TupleVisitorVisitEach
* @ingroup bind
*/
template <int T_loc, class T_functor, class... T_bound>
-struct visitor<bind_functor<T_loc, T_functor, T_bound...> >
+struct visitor<bind_functor<T_loc, T_functor, T_bound...>>
{
template <class T_action>
- static void do_visit_each(const T_action& _A_action,
- const bind_functor<T_loc, T_functor, T_bound...>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const bind_functor<T_loc, T_functor, T_bound...>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
sigc::visit_each(_A_action, std::get<0>(_A_target.bound_));
}
};
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::bind_functor performs a functor on the
* functor and on the object instances stored in the sigc::bind_functor object.
@@ -263,11 +252,11 @@ struct visitor<bind_functor<T_loc, T_functor, T_bound...> >
* @ingroup bind
*/
template <class T_functor, class... T_type>
-struct visitor<bind_functor<-1, T_functor, T_type...> >
+struct visitor<bind_functor<-1, T_functor, T_type...>>
{
template <typename T_action>
- static void do_visit_each(const T_action& _A_action,
- const bind_functor<-1, T_functor, T_type...>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const bind_functor<-1, T_functor, T_type...>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
@@ -277,7 +266,8 @@ struct visitor<bind_functor<-1, T_functor, T_type...> >
#endif // DOXYGEN_SHOULD_SKIP_THIS
-/** Creates an adaptor of type sigc::bind_functor which binds the passed argument to the passed functor.
+/** Creates an adaptor of type sigc::bind_functor which binds the passed argument to the passed
+ * functor.
* The optional template argument @e I_location specifies the zero-based
* position of the argument to be fixed (@p -1 stands for the last argument).
*
@@ -291,11 +281,11 @@ template <int I_location, class T_functor, class... T_bound>
inline decltype(auto)
bind(const T_functor& _A_func, T_bound... _A_b)
{
- return bind_functor<I_location, T_functor, T_bound...>
- (_A_func, _A_b...);
+ return bind_functor<I_location, T_functor, T_bound...>(_A_func, _A_b...);
}
-/** Creates an adaptor of type sigc::bind_functor which fixes the last arguments of the passed functor.
+/** Creates an adaptor of type sigc::bind_functor which fixes the last arguments of the passed
+ * functor.
* This function overload fixes the last arguments of @e _A_func.
*
* @param _A_func Functor that should be wrapped.
@@ -307,10 +297,10 @@ bind(const T_functor& _A_func, T_bound... _A_b)
template <class T_functor, class... T_type>
inline decltype(auto)
bind(const T_functor& _A_func, T_type... _A_b)
-{ return bind_functor<-1, T_functor, T_type...>(_A_func, _A_b...);
+{
+ return bind_functor<-1, T_functor, T_type...>(_A_func, _A_b...);
}
-
} /* namespace sigc */
#endif /* _SIGC_ADAPTORS_BIND_H_ */
diff --git a/sigc++/adaptors/bind_return.h b/sigc++/adaptors/bind_return.h
index 201376a..0f4f9b1 100644
--- a/sigc++/adaptors/bind_return.h
+++ b/sigc++/adaptors/bind_return.h
@@ -3,10 +3,12 @@
#include <sigc++/adaptors/adaptor_trait.h>
#include <sigc++/adaptors/bound_argument.h>
-namespace sigc {
+namespace sigc
+{
/** Adaptor that fixes the return value of the wrapped functor.
- * Use the convenience function sigc::bind_return() to create an instance of sigc::bind_return_functor.
+ * Use the convenience function sigc::bind_return() to create an instance of
+ * sigc::bind_return_functor.
*
* The following template arguments are used:
* - @e T_return Type of the fixed return value.
@@ -24,35 +26,41 @@ struct bind_return_functor : public adapts<T_functor>
*/
typename unwrap_reference<T_return>::type operator()();
-
/** Invokes the wrapped functor passing on the arguments.
* @param _A_a... Arguments to be passed on to the functor.
* @return The fixed return value.
*/
template <class... T_arg>
inline typename unwrap_reference<T_return>::type operator()(T_arg... _A_a)
- { this->functor_.template operator()<type_trait_pass_t<T_arg>...>
- (_A_a...); return ret_value_.invoke();
- }
+ {
+ this->functor_.template operator()<type_trait_pass_t<T_arg>...>(_A_a...);
+ return ret_value_.invoke();
+ }
/** Constructs a bind_return_functor object that fixes the return value to @p _A_ret_value.
* @param _A_functor Functor to invoke from operator()().
* @param _A_ret_value Value to return from operator()().
*/
- bind_return_functor(type_trait_take_t<T_functor> _A_functor, type_trait_take_t<T_return> _A_ret_value)
- : adapts<T_functor>(_A_functor), ret_value_(_A_ret_value)
- {}
+ bind_return_functor(
+ type_trait_take_t<T_functor> _A_functor, type_trait_take_t<T_return> _A_ret_value)
+ : adapts<T_functor>(_A_functor), ret_value_(_A_ret_value)
+ {
+ }
/// The fixed return value.
bound_argument<T_return> ret_value_; // public, so that visit_each() can access it
};
template <class T_return, class T_functor>
-typename unwrap_reference<T_return>::type bind_return_functor<T_return, T_functor>::operator()()
- { this->functor_(); return ret_value_.invoke(); }
+typename unwrap_reference<T_return>::type
+bind_return_functor<T_return, T_functor>::operator()()
+{
+ this->functor_();
+ return ret_value_.invoke();
+}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::bind_return_functor performs a functor on the
* functor and on the object instance stored in the sigc::bind_return_functor object.
@@ -60,11 +68,11 @@ typename unwrap_reference<T_return>::type bind_return_functor<T_return, T_functo
* @ingroup bind
*/
template <class T_return, class T_functor>
-struct visitor<bind_return_functor<T_return, T_functor> >
+struct visitor<bind_return_functor<T_return, T_functor>>
{
template <class T_action>
- static void do_visit_each(const T_action& _A_action,
- const bind_return_functor<T_return, T_functor>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const bind_return_functor<T_return, T_functor>& _A_target)
{
sigc::visit_each(_A_action, _A_target.ret_value_);
sigc::visit_each(_A_action, _A_target.functor_);
@@ -72,7 +80,8 @@ struct visitor<bind_return_functor<T_return, T_functor> >
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
-/** Creates an adaptor of type sigc::bind_return_functor which fixes the return value of the passed functor
to the passed argument.
+/** Creates an adaptor of type sigc::bind_return_functor which fixes the return value of the passed
+ * functor to the passed argument.
*
* @param _A_functor Functor that should be wrapped.
* @param _A_ret_value Argument to fix the return value of @e _A_functor to.
@@ -83,7 +92,9 @@ struct visitor<bind_return_functor<T_return, T_functor> >
template <class T_return, class T_functor>
inline bind_return_functor<T_return, T_functor>
bind_return(const T_functor& _A_functor, T_return _A_ret_value)
-{ return bind_return_functor<T_return, T_functor>(_A_functor, _A_ret_value); }
+{
+ return bind_return_functor<T_return, T_functor>(_A_functor, _A_ret_value);
+}
} /* namespace sigc */
#endif /* _SIGC_ADAPTORS_BIND_RETURN_H_ */
diff --git a/sigc++/adaptors/bound_argument.h b/sigc++/adaptors/bound_argument.h
index 60b26b1..aacf388 100644
--- a/sigc++/adaptors/bound_argument.h
+++ b/sigc++/adaptors/bound_argument.h
@@ -19,13 +19,14 @@
#ifndef _SIGC_BOUND_ARGUMENT_H_
#define _SIGC_BOUND_ARGUMENT_H_
-
#include <sigc++/limit_reference.h>
#include <sigc++/reference_wrapper.h>
-namespace sigc {
+namespace sigc
+{
-/** A bound_argument<Foo> object stores a bound (for instance, with sigc::bind(), or sigc::bind_return())
argument.
+/** A bound_argument<Foo> object stores a bound (for instance, with sigc::bind(), or
+ * sigc::bind_return()) argument.
*
* If Foo is a wrapped reference to a class Bar (std::reference_wrapper<Bar>) then this
* object is implemented on top of a limit_reference. When the slot is
@@ -52,21 +53,17 @@ public:
/** Constructor.
* @param _A_argument The argument to bind.
*/
- bound_argument(const T_type& _A_argument)
- : visited_(_A_argument)
- {}
+ bound_argument(const T_type& _A_argument) : visited_(_A_argument) {}
/** Retrieve the entity to visit in visit_each().
* @return The bound argument.
*/
- inline const T_type& visit() const
- { return visited_; }
+ inline const T_type& visit() const { return visited_; }
/** Retrieve the entity to pass to the bound functor or return.
* @return The bound argument.
*/
- inline T_type& invoke()
- { return visited_; }
+ inline T_type& invoke() { return visited_; }
private:
/** The value of the argument.
@@ -74,33 +71,32 @@ private:
T_type visited_;
};
-//Template specialization:
+// Template specialization:
/** bound_argument object for a bound argument that is passed by bind() or
* returned by bind_return() by reference, specialized for std::reference_wrapper<> types.
* @e T_wrapped The type of the bound argument.
*/
template <class T_wrapped>
-class bound_argument< std::reference_wrapper<T_wrapped> >
+class bound_argument<std::reference_wrapper<T_wrapped>>
{
public:
/** Constructor.
* @param _A_argument The argument to bind.
*/
bound_argument(const std::reference_wrapper<T_wrapped>& _A_argument)
- : visited_(unwrap(_A_argument))
- {}
+ : visited_(unwrap(_A_argument))
+ {
+ }
/** Retrieve the entity to visit in visit_each().
* @return The limited_reference to the bound argument.
*/
- inline const limit_reference<T_wrapped>& visit() const
- { return visited_; }
+ inline const limit_reference<T_wrapped>& visit() const { return visited_; }
/** Retrieve the entity to pass to the bound functor or return.
* @return The bound argument.
*/
- inline T_wrapped& invoke()
- { return visited_.invoke(); }
+ inline T_wrapped& invoke() { return visited_.invoke(); }
private:
/** The limited_reference to the bound argument.
@@ -113,27 +109,26 @@ private:
* - @e T_wrapped The type of the bound argument.
*/
template <class T_wrapped>
-class bound_argument< std::reference_wrapper<const T_wrapped> >
+class bound_argument<std::reference_wrapper<const T_wrapped>>
{
public:
/** Constructor.
* @param _A_argument The argument to bind.
*/
bound_argument(const std::reference_wrapper<const T_wrapped>& _A_argument)
- : visited_(unwrap(_A_argument))
- {}
+ : visited_(unwrap(_A_argument))
+ {
+ }
/** Retrieve the entity to visit in visit_each().
* @return The const_limited_reference to the bound argument.
*/
- inline const limit_reference<const T_wrapped>& visit() const
- { return visited_; }
+ inline const limit_reference<const T_wrapped>& visit() const { return visited_; }
/** Retrieve the entity to pass to the bound functor or return.
* @return The bound argument.
*/
- inline const T_wrapped& invoke()
- { return visited_.invoke(); }
+ inline const T_wrapped& invoke() { return visited_.invoke(); }
private:
/** The const_limited_reference to the bound argument.
@@ -151,11 +146,10 @@ private:
* @param _A_argument The visited instance.
*/
template <class T_type>
-struct visitor<bound_argument<T_type> >
+struct visitor<bound_argument<T_type>>
{
template <class T_action>
- static void do_visit_each(const T_action& _A_action,
- const bound_argument<T_type>& _A_argument)
+ static void do_visit_each(const T_action& _A_action, const bound_argument<T_type>& _A_argument)
{
sigc::visit_each(_A_action, _A_argument.visit());
}
@@ -164,5 +158,4 @@ struct visitor<bound_argument<T_type> >
} /* namespace sigc */
-
#endif /* _SIGC_BOUND_ARGUMENT_H_ */
diff --git a/sigc++/adaptors/compose.h b/sigc++/adaptors/compose.h
index adfc8f5..9d9050c 100644
--- a/sigc++/adaptors/compose.h
+++ b/sigc++/adaptors/compose.h
@@ -2,7 +2,8 @@
#define _SIGC_ADAPTORS_COMPOSE_H_
#include <sigc++/adaptors/adaptor_trait.h>
-namespace sigc {
+namespace sigc
+{
/** @defgroup compose compose()
* sigc::compose() combines two or three arbitrary functors.
@@ -14,7 +15,8 @@ namespace sigc {
* float square_root(float a) { return sqrtf(a); }
* float sum(float a, float b) { return a+b; }
* std::cout << sigc::compose(&square_root, &sum)(9, 16); // calls square_root(sum(3,6))
- * std::cout << sigc::compose(&sum, &square_root, &square_root)(9); // calls sum(square_root(9),
square_root(9))
+ * std::cout << sigc::compose(&sum, &square_root, &square_root)(9); // calls sum(square_root(9),
+ * square_root(9))
* @endcode
*
* The functor sigc::compose() returns can be passed directly into
@@ -46,24 +48,23 @@ struct compose1_functor : public adapts<T_setter>
using getter_type = T_getter;
using result_type = typename adaptor_type::result_type;
- decltype(auto)
- operator()()
- { return this->functor_(get_()); }
-
+ decltype(auto) operator()() { return this->functor_(get_()); }
template <class... T_arg>
- decltype(auto)
- operator()(T_arg&&... _A_a)
- { return this->functor_(get_(std::forward<T_arg>(_A_a)...));
- }
+ decltype(auto) operator()(T_arg&&... _A_a)
+ {
+ return this->functor_(get_(std::forward<T_arg>(_A_a)...));
+ }
/** Constructs a compose1_functor object that combines the passed functors.
- * @param _A_setter Functor that receives the return values of the invokation of @e _A_getter1 and @e
_A_getter2.
+ * @param _A_setter Functor that receives the return values of the invokation of @e _A_getter1 and
+ * @e _A_getter2.
* @param _A_getter Functor to invoke from operator()().
*/
compose1_functor(const T_setter& _A_setter, const T_getter& _A_getter)
- : adapts<T_setter>(_A_setter), get_(_A_getter)
- {}
+ : adapts<T_setter>(_A_setter), get_(_A_getter)
+ {
+ }
getter_type get_; // public, so that visit_each() can access it
};
@@ -87,34 +88,32 @@ struct compose2_functor : public adapts<T_setter>
using getter2_type = T_getter2;
using result_type = typename adaptor_type::result_type;
- decltype(auto)
- operator()()
- { return this->functor_(get1_(), get2_()); }
-
+ decltype(auto) operator()() { return this->functor_(get1_(), get2_()); }
template <class... T_arg>
- decltype(auto)
- operator()(T_arg... _A_a)
- { return this->functor_(get1_(_A_a...), get2_(_A_a...));
- }
+ decltype(auto) operator()(T_arg... _A_a)
+ {
+ return this->functor_(get1_(_A_a...), get2_(_A_a...));
+ }
/** Constructs a compose2_functor object that combines the passed functors.
- * @param _A_setter Functor that receives the return values of the invokation of @e _A_getter1 and @e
_A_getter2.
+ * @param _A_setter Functor that receives the return values of the invokation of @e _A_getter1 and
+ * @e _A_getter2.
* @param _A_getter1 Functor to invoke from operator()().
* @param _A_getter2 Functor to invoke from operator()().
*/
- compose2_functor(const T_setter& _A_setter,
- const T_getter1& _A_getter1,
- const T_getter2& _A_getter2)
- : adapts<T_setter>(_A_setter), get1_(_A_getter1), get2_(_A_getter2)
- {}
+ compose2_functor(
+ const T_setter& _A_setter, const T_getter1& _A_getter1, const T_getter2& _A_getter2)
+ : adapts<T_setter>(_A_setter), get1_(_A_getter1), get2_(_A_getter2)
+ {
+ }
getter1_type get1_; // public, so that visit_each() can access it
getter2_type get2_; // public, so that visit_each() can access it
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::compose1_functor performs a functor on the
* functors stored in the sigc::compose1_functor object.
@@ -122,18 +121,18 @@ struct compose2_functor : public adapts<T_setter>
* @ingroup compose
*/
template <class T_setter, class T_getter>
-struct visitor<compose1_functor<T_setter, T_getter> >
+struct visitor<compose1_functor<T_setter, T_getter>>
{
template <class T_action>
- static void do_visit_each(const T_action& _A_action,
- const compose1_functor<T_setter, T_getter>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const compose1_functor<T_setter, T_getter>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
sigc::visit_each(_A_action, _A_target.get_);
}
};
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::compose2_functor performs a functor on the
* functors stored in the sigc::compose2_functor object.
@@ -141,11 +140,11 @@ struct visitor<compose1_functor<T_setter, T_getter> >
* @ingroup compose
*/
template <class T_setter, class T_getter1, class T_getter2>
-struct visitor<compose2_functor<T_setter, T_getter1, T_getter2> >
+struct visitor<compose2_functor<T_setter, T_getter1, T_getter2>>
{
template <class T_action>
- static void do_visit_each(const T_action& _A_action,
- const compose2_functor<T_setter, T_getter1, T_getter2>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const compose2_functor<T_setter, T_getter1, T_getter2>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
sigc::visit_each(_A_action, _A_target.get1_);
@@ -158,28 +157,35 @@ struct visitor<compose2_functor<T_setter, T_getter1, T_getter2> >
*
* @param _A_setter Functor that receives the return value of the invokation of @e _A_getter.
* @param _A_getter Functor to invoke from operator()().
- * @return Adaptor that executes @e _A_setter with the value returned from invokation of @e _A_getter.
+ * @return Adaptor that executes @e _A_setter with the value returned from invokation of @e
+ * _A_getter.
*
* @ingroup compose
*/
template <class T_setter, class T_getter>
inline compose1_functor<T_setter, T_getter>
compose(const T_setter& _A_setter, const T_getter& _A_getter)
- { return compose1_functor<T_setter, T_getter>(_A_setter, _A_getter); }
+{
+ return compose1_functor<T_setter, T_getter>(_A_setter, _A_getter);
+}
/** Creates an adaptor of type sigc::compose2_functor which combines three functors.
*
- * @param _A_setter Functor that receives the return values of the invokation of @e _A_getter1 and @e
_A_getter2.
+ * @param _A_setter Functor that receives the return values of the invokation of @e _A_getter1 and
+ * @e _A_getter2.
* @param _A_getter1 Functor to invoke from operator()().
* @param _A_getter2 Functor to invoke from operator()().
- * @return Adaptor that executes @e _A_setter with the values return from invokation of @e _A_getter1 and @e
_A_getter2.
+ * @return Adaptor that executes @e _A_setter with the values return from invokation of @e
+ * _A_getter1 and @e _A_getter2.
*
* @ingroup compose
*/
template <class T_setter, class T_getter1, class T_getter2>
inline compose2_functor<T_setter, T_getter1, T_getter2>
compose(const T_setter& _A_setter, const T_getter1& _A_getter1, const T_getter2& _A_getter2)
- { return compose2_functor<T_setter, T_getter1, T_getter2>(_A_setter, _A_getter1, _A_getter2); }
+{
+ return compose2_functor<T_setter, T_getter1, T_getter2>(_A_setter, _A_getter1, _A_getter2);
+}
} /* namespace sigc */
#endif /* _SIGC_ADAPTORS_COMPOSE_H_ */
diff --git a/sigc++/adaptors/exception_catch.h b/sigc++/adaptors/exception_catch.h
index 5948a66..5ec721c 100644
--- a/sigc++/adaptors/exception_catch.h
+++ b/sigc++/adaptors/exception_catch.h
@@ -2,7 +2,8 @@
#define _SIGC_ADAPTORS_EXCEPTION_CATCH_H_
#include <sigc++/adaptors/adaptor_trait.h>
-namespace sigc {
+namespace sigc
+{
/*
functor adaptor: exception_catch(functor, catcher)
@@ -54,40 +55,42 @@ namespace sigc {
* @ingroup adaptors
*/
-template <class T_functor, class T_catcher, class T_return = typename adapts<T_functor>::result_type>
+template <class T_functor, class T_catcher,
+ class T_return = typename adapts<T_functor>::result_type>
struct exception_catch_functor : public adapts<T_functor>
{
using adaptor_type = typename adapts<T_functor>::adaptor_type;
using result_type = T_return;
- decltype(auto)
- operator()()
+ decltype(auto) operator()()
+ {
+ try
{
- try
- { return this->functor_(); }
- catch (...)
- { return catcher_(); }
+ return this->functor_();
}
-
+ catch (...)
+ {
+ return catcher_();
+ }
+ }
template <class... T_arg>
- decltype(auto)
- operator()(T_arg... _A_a)
+ decltype(auto) operator()(T_arg... _A_a)
+ {
+ try
{
- try
- {
- return this->functor_.template operator()<type_trait_pass_t<T_arg>...>
- (_A_a...);
- }
- catch (...)
- { return catcher_(); }
+ return this->functor_.template operator()<type_trait_pass_t<T_arg>...>(_A_a...);
}
+ catch (...)
+ {
+ return catcher_();
+ }
+ }
-
- exception_catch_functor(const T_functor& _A_func,
- const T_catcher& _A_catcher)
- : adapts<T_functor>(_A_func), catcher_(_A_catcher)
- {}
+ exception_catch_functor(const T_functor& _A_func, const T_catcher& _A_catcher)
+ : adapts<T_functor>(_A_func), catcher_(_A_catcher)
+ {
+ }
T_catcher catcher_;
};
@@ -100,37 +103,36 @@ struct exception_catch_functor<T_functor, T_catcher, void> : public adapts<T_fun
using adaptor_type = typename adapts<T_functor>::adaptor_type;
template <class... T_arg>
- decltype(auto)
- operator()(T_arg... _A_a)
+ decltype(auto) operator()(T_arg... _A_a)
+ {
+ try
{
- try
- {
- return this->functor_.template operator()<type_trait_pass_t<T_arg>...>
- (_A_a...);
- }
- catch (...)
- { return catcher_(); }
+ return this->functor_.template operator()<type_trait_pass_t<T_arg>...>(_A_a...);
}
-
+ catch (...)
+ {
+ return catcher_();
+ }
+ }
exception_catch_functor() {}
- exception_catch_functor(const T_functor& _A_func,
- const T_catcher& _A_catcher)
- : adapts<T_functor>(_A_func), catcher_(_A_catcher)
- {}
+ exception_catch_functor(const T_functor& _A_func, const T_catcher& _A_catcher)
+ : adapts<T_functor>(_A_func), catcher_(_A_catcher)
+ {
+ }
~exception_catch_functor() {}
- T_catcher catcher_;
+ T_catcher catcher_;
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
template <class T_functor, class T_catcher, class T_return>
-struct visitor<exception_catch_functor<T_functor, T_catcher, T_return> >
+struct visitor<exception_catch_functor<T_functor, T_catcher, T_return>>
{
template <typename T_action>
static void do_visit_each(const T_action& _A_action,
- const exception_catch_functor<T_functor, T_catcher, T_return>& _A_target)
+ const exception_catch_functor<T_functor, T_catcher, T_return>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
sigc::visit_each(_A_action, _A_target.catcher_);
@@ -141,7 +143,9 @@ struct visitor<exception_catch_functor<T_functor, T_catcher, T_return> >
template <class T_functor, class T_catcher>
inline decltype(auto)
exception_catch(const T_functor& _A_func, const T_catcher& _A_catcher)
- { return exception_catch_functor<T_functor, T_catcher>(_A_func, _A_catcher); }
+{
+ return exception_catch_functor<T_functor, T_catcher>(_A_func, _A_catcher);
+}
} /* namespace sigc */
#endif /* _SIGC_ADAPTORS_EXCEPTION_CATCH_H_ */
diff --git a/sigc++/adaptors/hide.h b/sigc++/adaptors/hide.h
index 6717aa4..f31b46d 100644
--- a/sigc++/adaptors/hide.h
+++ b/sigc++/adaptors/hide.h
@@ -5,7 +5,8 @@
#include <sigc++/tuple-utils/tuple_end.h>
#include <sigc++/tuple-utils/tuple_start.h>
-namespace sigc {
+namespace sigc
+{
/** @defgroup hide hide(), hide_return()
* sigc::hide() alters an arbitrary functor in that it adds a parameter
@@ -15,7 +16,8 @@ namespace sigc {
* You may optionally specify the zero-based position of the parameter
* to ignore as a template argument. The default is to ignore the last
* parameter.
- * (A value of @p -1 adds a parameter at the end so sigc::hide<-1>() gives the same result as sigc::hide().)
+ * (A value of @p -1 adds a parameter at the end so sigc::hide<-1>() gives the same result as
+ sigc::hide().)
*
* The type of the parameter can optionally be specified if not deduced.
*
@@ -44,7 +46,8 @@ namespace sigc {
* @par Example:
* @code
* // multiple argument hiding ...
- * sigc::hide(sigc::hide(&foo))(1,2,3,4); // adds two dummy parameters at the back and calls foo(1,2)
+ * sigc::hide(sigc::hide(&foo))(1,2,3,4); // adds two dummy parameters at the back and calls
+ foo(1,2)
* @endcode
* sigc::hide_return() alters an arbitrary functor by
@@ -53,7 +56,6 @@ namespace sigc {
* @ingroup adaptors
*/
-
/** Adaptor that adds a dummy parameter to the wrapped functor.
* Use the convenience function sigc::hide() to create an instance of sigc::hide_functor.
*
@@ -75,48 +77,42 @@ struct hide_functor : public adapts<T_functor>
* @return The return value of the functor invocation.
*/
template <class... T_arg>
- decltype(auto)
- operator()(T_arg&&... _A_a)
- {
- constexpr auto size = sizeof...(T_arg);
- constexpr auto index_ignore = (I_location == -1 ? size - 1 : I_location);
- const auto t = std::tuple<T_arg...>(std::forward<T_arg>(_A_a)...);
+ decltype(auto) operator()(T_arg&&... _A_a)
+ {
+ constexpr auto size = sizeof...(T_arg);
+ constexpr auto index_ignore = (I_location == -1 ? size - 1 : I_location);
+ const auto t = std::tuple<T_arg...>(std::forward<T_arg>(_A_a)...);
- const auto t_start = internal::tuple_start<index_ignore>(t);
- const auto t_end = internal::tuple_end<size - index_ignore - 1>(t);
- const auto t_used = std::tuple_cat(t_start, t_end);
+ const auto t_start = internal::tuple_start<index_ignore>(t);
+ const auto t_end = internal::tuple_end<size - index_ignore - 1>(t);
+ const auto t_used = std::tuple_cat(t_start, t_end);
- constexpr auto size_used = size - 1;
+ constexpr auto size_used = size - 1;
- //TODO: Remove these? They are just here as a sanity check.
- static_assert(std::tuple_size<decltype(t_used)>::value == size_used, "Unexpected t_used size.");
+ // TODO: Remove these? They are just here as a sanity check.
+ static_assert(std::tuple_size<decltype(t_used)>::value == size_used, "Unexpected t_used size.");
- const auto seq = std::make_index_sequence<size_used>();
- return call_functor_operator_parentheses(t_used, seq);
- }
+ const auto seq = std::make_index_sequence<size_used>();
+ return call_functor_operator_parentheses(t_used, seq);
+ }
/** Constructs a hide_functor object that adds a dummy parameter to the passed functor.
* @param _A_func Functor to invoke from operator()().
*/
- explicit hide_functor(const T_functor& _A_func)
- : adapts<T_functor>(_A_func)
- {}
+ explicit hide_functor(const T_functor& _A_func) : adapts<T_functor>(_A_func) {}
private:
- //TODO_variadic: Replace this with std::experimental::apply() if that becomes standard
- //C++, or add our own implementation, to avoid code duplication.
- template<class T_tuple, std::size_t... Is>
- decltype(auto)
- call_functor_operator_parentheses(T_tuple& tuple,
- std::index_sequence<Is...>)
+ // TODO_variadic: Replace this with std::experimental::apply() if that becomes standard
+ // C++, or add our own implementation, to avoid code duplication.
+ template <class T_tuple, std::size_t... Is>
+ decltype(auto) call_functor_operator_parentheses(T_tuple& tuple, std::index_sequence<Is...>)
{
return this->functor_.template operator()(std::get<Is>(tuple)...);
}
};
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::hide_functor performs a functor on the
* functor stored in the sigc::hide_functor object.
@@ -124,18 +120,19 @@ private:
* @ingroup hide
*/
template <int I_location, class T_functor>
-struct visitor<hide_functor<I_location, T_functor> >
+struct visitor<hide_functor<I_location, T_functor>>
{
template <typename T_action>
- static void do_visit_each(const T_action& _A_action,
- const hide_functor<I_location, T_functor>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const hide_functor<I_location, T_functor>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
}
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
-/** Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor.
+/** Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed
+ * functor.
* The optional template argument @e I_location specifies the zero-based
* position of the dummy parameter in the returned functor (@p -1 stands for the last parameter).
*
@@ -147,9 +144,12 @@ struct visitor<hide_functor<I_location, T_functor> >
template <int I_location, class T_functor>
inline decltype(auto)
hide(const T_functor& _A_func)
- { return hide_functor<I_location, T_functor>(_A_func); }
+{
+ return hide_functor<I_location, T_functor>(_A_func);
+}
-/** Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed functor.
+/** Creates an adaptor of type sigc::hide_functor which adds a dummy parameter to the passed
+ * functor.
* This overload adds a dummy parameter at the back of the functor's parameter list.
*
* @param _A_func Functor that should be wrapped.
@@ -160,7 +160,9 @@ hide(const T_functor& _A_func)
template <class T_functor>
inline decltype(auto)
hide(const T_functor& _A_func)
- { return hide_functor<-1, T_functor> (_A_func); }
+{
+ return hide_functor<-1, T_functor>(_A_func);
+}
} /* namespace sigc */
diff --git a/sigc++/adaptors/retype.h b/sigc++/adaptors/retype.h
index ba7a8b3..92c381e 100644
--- a/sigc++/adaptors/retype.h
+++ b/sigc++/adaptors/retype.h
@@ -6,7 +6,8 @@
#include <sigc++/functors/mem_fun.h>
#include <sigc++/functors/slot.h>
-namespace sigc {
+namespace sigc
+{
/** @defgroup retype retype(), retype_return()
* sigc::retype() alters a sigc::pointer_functor, a sigc::mem_functor or a sigc::slot
@@ -58,29 +59,29 @@ namespace sigc {
* @ingroup retype
*/
template <class T_functor, class... T_type>
-struct retype_functor
- : public adapts<T_functor>
+struct retype_functor : public adapts<T_functor>
{
using adaptor_type = typename adapts<T_functor>::adaptor_type;
using result_type = typename adapts<T_functor>::result_type;
template <class... T_arg>
- decltype(auto)
- operator()(T_arg... _A_a)
- { return this->functor_.template operator()<type_trait_take_t<T_type>...>
- (static_cast<T_type>(_A_a)...);
- }
+ decltype(auto) operator()(T_arg... _A_a)
+ {
+ return this->functor_.template operator()<type_trait_take_t<T_type>...>(
+ static_cast<T_type>(_A_a)...);
+ }
- /** Constructs a retype_functor object that performs C-style casts on the parameters passed on to the
functor.
+ /** Constructs a retype_functor object that performs C-style casts on the parameters passed on to
+ * the functor.
* @param _A_functor Functor to invoke from operator()().
*/
- explicit retype_functor(type_trait_take_t<T_functor> _A_functor)
- : adapts<T_functor>(_A_functor)
- {}
+ explicit retype_functor(type_trait_take_t<T_functor> _A_functor) : adapts<T_functor>(_A_functor)
+ {
+ }
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::retype_functor performs a functor on the
* functor stored in the sigc::retype_functor object.
@@ -88,44 +89,48 @@ struct retype_functor
* @ingroup retype
*/
template <class T_functor, class... T_type>
-struct visitor<retype_functor<T_functor, T_type...> >
+struct visitor<retype_functor<T_functor, T_type...>>
{
template <typename T_action>
- static void do_visit_each(const T_action& _A_action,
- const retype_functor<T_functor, T_type...>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const retype_functor<T_functor, T_type...>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
}
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
-//This one takes, for instance, a mem_functor or bound_mem_functor:
-/** Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed on
to the functor.
+// This one takes, for instance, a mem_functor or bound_mem_functor:
+/** Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters
+ * passed on to the functor.
*
* @param _A_functor Functor that should be wrapped.
* @return Adaptor that executes @e _A_functor performing C-style casts on the paramters passed on.
*
* @ingroup retype
*/
-template <template<class T_func, class... T_arg> class T_functor, class T_func, class... T_arg>
+template <template <class T_func, class... T_arg> class T_functor, class T_func, class... T_arg>
inline decltype(auto)
retype(const T_functor<T_func, T_arg...>& _A_functor)
-{ return retype_functor<T_functor<T_func, T_arg...>, T_arg...>
- (_A_functor); }
+{
+ return retype_functor<T_functor<T_func, T_arg...>, T_arg...>(_A_functor);
+}
-//This one takes, for instance, a pointer_functor or slot:
-/** Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters passed on
to the functor.
+// This one takes, for instance, a pointer_functor or slot:
+/** Creates an adaptor of type sigc::retype_functor which performs C-style casts on the parameters
+ * passed on to the functor.
*
* @param _A_functor Functor that should be wrapped.
* @return Adaptor that executes @e _A_functor performing C-style casts on the paramters passed on.
*
* @ingroup retype
*/
-template <template<class T_return, class... T_arg> class T_functor, class T_return, class... T_arg>
+template <template <class T_return, class... T_arg> class T_functor, class T_return, class... T_arg>
inline decltype(auto)
retype(const T_functor<T_return(T_arg...)>& _A_functor)
-{ return retype_functor<T_functor<T_return(T_arg...)>, T_arg...>
- (_A_functor); }
+{
+ return retype_functor<T_functor<T_return(T_arg...)>, T_arg...>(_A_functor);
+}
} /* namespace sigc */
diff --git a/sigc++/adaptors/retype_return.h b/sigc++/adaptors/retype_return.h
index 0654592..52f3468 100644
--- a/sigc++/adaptors/retype_return.h
+++ b/sigc++/adaptors/retype_return.h
@@ -2,10 +2,12 @@
#define _SIGC_ADAPTORS_RETYPE_RETURN_H_
#include <sigc++/adaptors/adaptor_trait.h>
-namespace sigc {
+namespace sigc
+{
/** Adaptor that performs a C-style cast on the return value of a functor.
- * Use the convenience function sigc::retype_return() to create an instance of retype_return_functor.
+ * Use the convenience function sigc::retype_return() to create an instance of
+ * retype_return_functor.
*
* The following template arguments are used:
* - @e T_return Target type of the C-style cast.
@@ -20,31 +22,36 @@ struct retype_return_functor : public adapts<T_functor>
T_return operator()();
-
template <class... T_arg>
inline T_return operator()(T_arg&&... _A_a)
- { return T_return(this->functor_.template operator()<T_arg...>
- (std::forward<T_arg>(_A_a)...));
- }
+ {
+ return T_return(this->functor_.template operator() < T_arg... > (std::forward<T_arg>(_A_a)...));
+ }
retype_return_functor() {}
- /** Constructs a retype_return_functor object that perform a C-style cast on the return value of the
passed functor.
+ /** Constructs a retype_return_functor object that perform a C-style cast on the return value of
+ * the passed functor.
* @param _A_functor Functor to invoke from operator()().
*/
explicit retype_return_functor(type_trait_take_t<T_functor> _A_functor)
- : adapts<T_functor>(_A_functor)
- {}
+ : adapts<T_functor>(_A_functor)
+ {
+ }
};
template <class T_return, class T_functor>
-T_return retype_return_functor<T_return, T_functor>::operator()()
- { return T_return(this->functor_()); }
-
+T_return
+retype_return_functor<T_return, T_functor>::operator()()
+{
+ return T_return(this->functor_());
+}
/** Adaptor that performs a C-style cast on the return value of a functor.
- * This template specialization is for a void return. It drops the return value of the functor it invokes.
- * Use the convenience function sigc::hide_return() to create an instance of
sigc::retype_return_functor<void>.
+ * This template specialization is for a void return. It drops the return value of the functor it
+ * invokes.
+ * Use the convenience function sigc::hide_return() to create an instance of
+ * sigc::retype_return_functor<void>.
*
* @ingroup retype
*/
@@ -57,25 +64,25 @@ struct retype_return_functor<void, T_functor> : public adapts<T_functor>
void operator()();
-
template <class... T_arg>
inline void operator()(T_arg... _A_a)
- { this->functor_.template operator()<T_arg...>
- (_A_a...);
- }
+ {
+ this->functor_.template operator()<T_arg...>(_A_a...);
+ }
retype_return_functor() {}
- retype_return_functor(type_trait_take_t<T_functor> _A_functor)
- : adapts<T_functor>(_A_functor)
- {}
+ retype_return_functor(type_trait_take_t<T_functor> _A_functor) : adapts<T_functor>(_A_functor) {}
};
template <class T_functor>
-void retype_return_functor<void, T_functor>::operator()()
- { this->functor_(); }
+void
+retype_return_functor<void, T_functor>::operator()()
+{
+ this->functor_();
+}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::retype_return_functor performs a functor on the
* functor stored in the sigc::retype_return_functor object.
@@ -83,18 +90,19 @@ void retype_return_functor<void, T_functor>::operator()()
* @ingroup retype
*/
template <class T_return, class T_functor>
-struct visitor<retype_return_functor<T_return, T_functor> >
+struct visitor<retype_return_functor<T_return, T_functor>>
{
template <typename T_action>
- static void do_visit_each(const T_action& _A_action,
- const retype_return_functor<T_return, T_functor>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const retype_return_functor<T_return, T_functor>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
}
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
-/** Creates an adaptor of type sigc::retype_return_functor which performs a C-style cast on the return value
of the passed functor.
+/** Creates an adaptor of type sigc::retype_return_functor which performs a C-style cast on the
+ * return value of the passed functor.
* The template argument @e T_return specifies the target type of the cast.
*
* @param _A_functor Functor that should be wrapped.
@@ -105,9 +113,12 @@ struct visitor<retype_return_functor<T_return, T_functor> >
template <class T_return, class T_functor>
inline retype_return_functor<T_return, T_functor>
retype_return(const T_functor& _A_functor)
- { return retype_return_functor<T_return, T_functor>(_A_functor); }
+{
+ return retype_return_functor<T_return, T_functor>(_A_functor);
+}
-/** Creates an adaptor of type sigc::retype_return_functor which drops the return value of the passed
functor.
+/** Creates an adaptor of type sigc::retype_return_functor which drops the return value of the
+ * passed functor.
*
* @param _A_functor Functor that should be wrapped.
* @return Adaptor that executes @e _A_functor dropping its return value.
@@ -117,7 +128,9 @@ retype_return(const T_functor& _A_functor)
template <class T_functor>
inline retype_return_functor<void, T_functor>
hide_return(const T_functor& _A_functor)
- { return retype_return_functor<void, T_functor>(_A_functor); }
+{
+ return retype_return_functor<void, T_functor>(_A_functor);
+}
} /* namespace sigc */
#endif /* _SIGC_ADAPTORS_RETYPE_RETURN_H_ */
diff --git a/sigc++/adaptors/track_obj.h b/sigc++/adaptors/track_obj.h
index 69a5c9b..d379e45 100644
--- a/sigc++/adaptors/track_obj.h
+++ b/sigc++/adaptors/track_obj.h
@@ -5,7 +5,8 @@
#include <sigc++/limit_reference.h>
#include <sigc++/tuple-utils/tuple_for_each.h>
-namespace sigc {
+namespace sigc
+{
/** @defgroup track_obj track_obj()
* sigc::track_obj() tracks trackable objects, referenced from a functor.
@@ -59,38 +60,36 @@ public:
* @param _A_obj Trackable objects.
*/
track_obj_functor(const T_functor& _A_func, const T_obj&... _A_obj)
- : adapts<T_functor>(_A_func), obj_(_A_obj...) {}
+ : adapts<T_functor>(_A_func), obj_(_A_obj...)
+ {
+ }
/** Invokes the wrapped functor.
* @return The return value of the functor invocation.
*/
- decltype(auto) operator()()
- { return this->functor_(); }
-
+ decltype(auto) operator()() { return this->functor_(); }
/** Invokes the wrapped functor passing on the arguments.
* @param _A_arg... Arguments to be passed on to the functor.
* @return The return value of the functor invocation.
*/
template <typename... T_arg>
- decltype(auto)
- operator()(T_arg&&... _A_arg)
+ decltype(auto) operator()(T_arg&&... _A_arg)
{
- return this->functor_.template operator()<type_trait_pass_t<T_arg>...>
- (std::forward<T_arg>(_A_arg)...);
+ return this->functor_.template operator()<type_trait_pass_t<T_arg>...>(
+ std::forward<T_arg>(_A_arg)...);
}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//protected:
+ // protected:
// public, so that visit_each() can access it.
std::tuple<limit_reference<const T_obj>...> obj_;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
}; // end class track_obj_functor
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::track_obj_functor performs a functor
* on the functor and on the trackable object instances stored in the
@@ -104,32 +103,29 @@ 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& _A_action,
- const track_obj_functor<T_functor, T_obj...>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const track_obj_functor<T_functor, T_obj...>& _A_target)
{
sigc::visit_each(_A_action, _A_target.functor_);
- //Call sigc::visit_each(_A_action, element) on each element in the
+ // Call sigc::visit_each(_A_action, element) on each element in the
//_A_target.obj_ tuple:
sigc::internal::tuple_for_each<TrackObjVisitForEach>(_A_target.obj_, _A_action);
}
private:
- template<typename T_element>
+ template <typename T_element>
struct TrackObjVisitForEach
{
- template<typename T_action>
- static
- void
- visit(const T_element& element, const T_action& action)
+ template <typename T_action>
+ static void visit(const T_element& element, const T_action& action)
{
- sigc::visit_each(action, element);
+ sigc::visit_each(action, element);
}
};
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
-
/** Creates an adaptor of type sigc::track_obj_functor which wraps a functor.
* @param _A_func Functor that shall be wrapped.
* @param _A_obj Trackable objects.
@@ -143,11 +139,9 @@ template <typename T_functor, typename... T_obj>
inline decltype(auto)
track_obj(const T_functor& _A_func, const T_obj&... _A_obj)
{
- return track_obj_functor<T_functor, T_obj...>
- (_A_func, _A_obj...);
+ return track_obj_functor<T_functor, T_obj...>(_A_func, _A_obj...);
}
-
} /* namespace sigc */
#endif /* _SIGC_ADAPTORS_TRACK_OBJ_H_ */
diff --git a/sigc++/bind_return.h b/sigc++/bind_return.h
index fa90c45..97873da 100644
--- a/sigc++/bind_return.h
+++ b/sigc++/bind_return.h
@@ -21,5 +21,4 @@
#include <sigc++/adaptors/bind_return.h>
-
#endif /* _SIGC_BIND_RETURN_HPP_ */
diff --git a/sigc++/connection.h b/sigc++/connection.h
index 87202de..058d0d5 100644
--- a/sigc++/connection.h
+++ b/sigc++/connection.h
@@ -21,7 +21,8 @@
#include <sigc++config.h>
#include <sigc++/signal.h>
-namespace sigc {
+namespace sigc
+{
/** Convinience class for safe disconnection.
* Iterators must not be used beyond the lifetime of the list
@@ -52,7 +53,10 @@ struct SIGC_API connection : public notifiable
*/
template <typename T_slot>
connection(const slot_iterator<T_slot>& it) : slot_(&(*it))
- { if (slot_) slot_->add_destroy_notify_callback(this, ¬ify); }
+ {
+ if (slot_)
+ slot_->add_destroy_notify_callback(this, ¬ify);
+ }
/** Constructs a connection object from a slot object.
* This is only useful if you create your own slot list.
@@ -70,7 +74,10 @@ struct SIGC_API connection : public notifiable
*/
template <typename T_slot>
connection& operator=(const slot_iterator<T_slot>& it)
- { set_slot(&(*it)); return *this; }
+ {
+ set_slot(&(*it));
+ return *this;
+ }
~connection();
@@ -125,5 +132,4 @@ private:
} /* namespace sigc */
-
#endif /* _SIGC_TRACKABLE_HPP_ */
diff --git a/sigc++/functors/functor_base.h b/sigc++/functors/functor_base.h
index 0c5c0b8..6450b41 100644
--- a/sigc++/functors/functor_base.h
+++ b/sigc++/functors/functor_base.h
@@ -1,15 +1,17 @@
#ifndef _SIGC_FUNCTORS_FUNCTOR_BASE_H_
#define _SIGC_FUNCTORS_FUNCTOR_BASE_H_
-namespace sigc {
+namespace sigc
+{
/** A hint to the compiler.
* All functors which define @p result_type should publically inherit from this hint.
*
* @ingroup sigcfunctors
*/
-struct functor_base {};
-
+struct functor_base
+{
+};
} /* namespace sigc */
#endif /* _SIGC_FUNCTORS_FUNCTOR_BASE_H_ */
diff --git a/sigc++/functors/functor_trait.h b/sigc++/functors/functor_trait.h
index 9ac2977..44f0499 100644
--- a/sigc++/functors/functor_trait.h
+++ b/sigc++/functors/functor_trait.h
@@ -6,7 +6,8 @@
#include <sigc++/type_traits.h>
#include <type_traits>
-namespace sigc {
+namespace sigc
+{
/** @defgroup sigcfunctors Functors
* Functors are copyable types that define operator()().
@@ -44,7 +45,7 @@ namespace sigc {
*
* If all these ways to deduce the result type fail, void is assumed.
*
- * With libsigc++ versions before 2.6, the macro
+ * With libsigc++ versions before 2.6, the macro
* #SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE activated the test with
* decltype(). That macro is now unneccesary and deprecated.
*/
@@ -80,7 +81,6 @@ public:
;
};
-
/** Trait that specifies the return type of any type.
* Template specializations for functors derived from sigc::functor_base,
* for other functors whose result type can be deduced with decltype(),
@@ -94,8 +94,8 @@ public:
* @ingroup sigcfunctors
*/
template <class T_functor,
- bool I_derives_functor_base = std::is_base_of<functor_base,T_functor>::value,
- bool I_can_use_decltype = can_deduce_result_type_with_decltype<T_functor>::value>
+ bool I_derives_functor_base = std::is_base_of<functor_base, T_functor>::value,
+ bool I_can_use_decltype = can_deduce_result_type_with_decltype<T_functor>::value>
struct functor_trait
{
using result_type = void;
@@ -113,7 +113,8 @@ struct functor_trait<T_functor, true, I_can_use_decltype>
template <typename T_functor>
struct functor_trait<T_functor, false, true>
{
- using result_type = typename functor_trait<decltype(&T_functor::operator()), false, false>::result_type;
+ using result_type =
+ typename functor_trait<decltype(&T_functor::operator()), false, false>::result_type;
using functor_type = T_functor;
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
@@ -128,13 +129,13 @@ struct functor_trait<T_functor, false, true>
*
* @ingroup sigcfunctors
*/
-#define SIGC_FUNCTORS_HAVE_RESULT_TYPE \
-template <class T_functor> \
-struct functor_trait<T_functor, false, false> \
-{ \
- using result_type = typename T_functor::result_type; \
- using functor_type = T_functor; \
-};
+#define SIGC_FUNCTORS_HAVE_RESULT_TYPE \
+ template <class T_functor> \
+ struct functor_trait<T_functor, false, false> \
+ { \
+ using result_type = typename T_functor::result_type; \
+ using functor_type = T_functor; \
+ };
/** Helper macro, if you want to mix user-defined and third party functors with libsigc++.
*
@@ -151,19 +152,19 @@ struct functor_trait<T_functor, false, false> \
*
* @ingroup sigcfunctors
*/
-#define SIGC_FUNCTOR_TRAIT(T_functor,T_return) \
-template <> \
-struct functor_trait<T_functor, false, false> \
-{ \
- using result_type = T_return; \
- using functor_type = T_functor; \
-}; \
-template <> \
-struct functor_trait<T_functor, false, true> \
-{ \
- using result_type = T_return; \
- using functor_type = T_functor; \
-};
+#define SIGC_FUNCTOR_TRAIT(T_functor, T_return) \
+ template <> \
+ struct functor_trait<T_functor, false, false> \
+ { \
+ using result_type = T_return; \
+ using functor_type = T_functor; \
+ }; \
+ template <> \
+ struct functor_trait<T_functor, false, true> \
+ { \
+ using result_type = T_return; \
+ using functor_type = T_functor; \
+ };
#ifndef SIGCXX_DISABLE_DEPRECATED
/** Helper macro, if you want to mix user-defined and third party functors with libsigc++.
@@ -192,7 +193,7 @@ struct functor_trait<T_functor, false, true> \
#ifndef DOXYGEN_SHOULD_SKIP_THIS
// detect the return type and the functor version of non-functor types.
-//functor ptr fun:
+// functor ptr fun:
template <class T_return, class... T_arg>
struct functor_trait<T_return (*)(T_arg...), false, false>
@@ -201,25 +202,20 @@ struct functor_trait<T_return (*)(T_arg...), false, false>
using functor_type = pointer_functor<T_return(T_arg...)>;
};
-
-//functor mem fun:
+// functor mem fun:
template <class T_return, class T_obj, class... T_arg>
struct functor_trait<T_return (T_obj::*)(T_arg...), false, false>
{
using result_type = T_return;
- using functor_type = mem_functor<
- T_return (T_obj::*)(T_arg...),
- T_arg...>;
+ using functor_type = mem_functor<T_return (T_obj::*)(T_arg...), T_arg...>;
};
template <class T_return, class T_obj, class... T_arg>
struct functor_trait<T_return (T_obj::*)(T_arg...) const, false, false>
{
using result_type = T_return;
- using functor_type = mem_functor<
- T_return (T_obj::*)(T_arg...) const,
- T_arg...>;
+ using functor_type = mem_functor<T_return (T_obj::*)(T_arg...) const, T_arg...>;
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
diff --git a/sigc++/functors/mem_fun.h b/sigc++/functors/mem_fun.h
index 5caac6b..e9dc65f 100644
--- a/sigc++/functors/mem_fun.h
+++ b/sigc++/functors/mem_fun.h
@@ -9,7 +9,8 @@
// an extra copy and complicate the header include order if bind is
// to have automatic conversion for member pointers.
-namespace sigc {
+namespace sigc
+{
/** @defgroup mem_fun mem_fun()
* mem_fun() is used to convert a pointer to a method to a functor.
@@ -74,8 +75,9 @@ public:
using function_type = T_func;
using result_type = typename internal::member_method_result<T_func>::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>;
/// Constructs an invalid functor.
mem_functor() : func_ptr_(nullptr) {}
@@ -90,31 +92,31 @@ public:
* @param _A_a... Argument to be passed on to the method.
* @return The return value of the method invocation.
*/
- decltype(auto)
- operator()(obj_type_with_modifier& _A_obj, type_trait_take_t<T_arg>... _A_a) const
- { return (_A_obj.*func_ptr_)(_A_a...); }
+ decltype(auto) operator()(obj_type_with_modifier& _A_obj, type_trait_take_t<T_arg>... _A_a) const
+ {
+ return (_A_obj.*func_ptr_)(_A_a...);
+ }
protected:
function_type func_ptr_;
};
-
-template <class T_func,
- class... T_arg>
-class bound_mem_functor
-: mem_functor<T_func, T_arg...>
+template <class T_func, class... T_arg>
+class bound_mem_functor : mem_functor<T_func, T_arg...>
{
using base_type = mem_functor<T_func, T_arg...>;
+
public:
using function_type = typename base_type::function_type;
using result_type = typename base_type::result_type;
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 T_limit_reference = typename std::conditional_t<
- internal::member_method_is_const<T_func>::value,
+ 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>>;
/** Constructs a bound_mem_functor object that wraps the passed method.
@@ -122,27 +124,27 @@ public:
* @param _A_func Pointer to method will be invoked from operator()().
*/
bound_mem_functor(obj_type_with_modifier& _A_obj, function_type _A_func)
- : base_type(_A_func),
- obj_(_A_obj)
- {}
+ : base_type(_A_func), obj_(_A_obj)
+ {
+ }
/** Execute the wrapped method operating on the stored instance.
* @param _A_a... Argument to be passed on to the method.
* @return The return value of the method invocation.
*/
- decltype(auto)
- operator()(type_trait_take_t<T_arg>... _A_a) const
- { return (obj_.invoke().*(this->func_ptr_))(_A_a...); }
+ decltype(auto) operator()(type_trait_take_t<T_arg>... _A_a) const
+ {
+ return (obj_.invoke().*(this->func_ptr_))(_A_a...);
+ }
-//protected:
+ // protected:
// Reference to stored object instance.
// This is the handler object, such as TheObject in void TheObject::signal_handler().
T_limit_reference obj_;
};
-
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
* The function overload for sigc::bound_$1mem_functor performs a functor
* on the object instance stored in the sigc::bound_$1mem_functor object.
@@ -150,18 +152,17 @@ public:
* @ingroup mem_fun
*/
template <class T_func, class... T_arg>
-struct visitor<bound_mem_functor<T_func, T_arg...> >
+struct visitor<bound_mem_functor<T_func, T_arg...>>
{
template <class T_action>
- static void do_visit_each(const T_action& _A_action,
- const bound_mem_functor<T_func, T_arg...>& _A_target)
+ static void do_visit_each(
+ const T_action& _A_action, const bound_mem_functor<T_func, T_arg...>& _A_target)
{
sigc::visit_each(_A_action, _A_target.obj_);
}
};
#endif // DOXYGEN_SHOULD_SKIP_THIS
-
/** Creates a functor of type sigc::mem_functor which wraps a method.
* @param _A_func Pointer to method that should be wrapped.
* @return Functor that executes _A_func on invokation.
@@ -170,11 +171,10 @@ struct visitor<bound_mem_functor<T_func, T_arg...> >
*/
template <class T_return, class T_obj, class... T_arg>
inline decltype(auto)
-mem_fun(T_return (T_obj::*_A_func)(T_arg...) )
-{ return mem_functor<
- T_return (T_obj::*)(T_arg...) ,
- T_arg...>(_A_func); }
-
+mem_fun(T_return (T_obj::*_A_func)(T_arg...))
+{
+ return mem_functor<T_return (T_obj::*)(T_arg...), T_arg...>(_A_func);
+}
/** Creates a functor of type sigc::const_mem_functor which wraps a const method.
* @param _A_func Pointer to method that should be wrapped.
@@ -185,10 +185,9 @@ mem_fun(T_return (T_obj::*_A_func)(T_arg...) )
template <class T_return, class T_obj, class... T_arg>
inline decltype(auto)
mem_fun(T_return (T_obj::*_A_func)(T_arg...) const)
-{ return mem_functor<
- T_return (T_obj::*)(T_arg...) const,
- T_arg...>(_A_func); }
-
+{
+ return mem_functor<T_return (T_obj::*)(T_arg...) const, T_arg...>(_A_func);
+}
/** Creates a functor of type sigc::volatile_mem_functor which wraps a volatile method.
* @param _A_func Pointer to method that should be wrapped.
@@ -199,10 +198,9 @@ mem_fun(T_return (T_obj::*_A_func)(T_arg...) const)
template <class T_return, class T_obj, class... T_arg>
inline decltype(auto)
mem_fun(T_return (T_obj::*_A_func)(T_arg...) volatile)
-{ return mem_functor<
- T_return (T_obj::*)(T_arg...) volatile,
- T_arg...>(_A_func); }
-
+{
+ return mem_functor<T_return (T_obj::*)(T_arg...) volatile, T_arg...>(_A_func);
+}
/** Creates a functor of type sigc::const_volatile_mem_functor which wraps a const volatile method.
* @param _A_func Pointer to method that should be wrapped.
@@ -213,12 +211,12 @@ mem_fun(T_return (T_obj::*_A_func)(T_arg...) volatile)
template <class T_return, class T_obj, class... T_arg>
inline decltype(auto)
mem_fun(T_return (T_obj::*_A_func)(T_arg...) const volatile)
-{ return mem_functor<
- T_return (T_obj::*)(T_arg...) const volatile,
- T_arg...>(_A_func); }
-
+{
+ return mem_functor<T_return (T_obj::*)(T_arg...) const volatile, T_arg...>(_A_func);
+}
-/** Creates a functor of type sigc::bound_mem_functor which encapsulates a method and an object instance.
+/** Creates a functor of type sigc::bound_mem_functor which encapsulates a method and an object
+ * instance.
* @param _A_obj Reference to object instance the functor should operate on.
* @param _A_func Pointer to method that should be wrapped.
* @return Functor that executes @e _A_func on invokation.
@@ -227,14 +225,13 @@ mem_fun(T_return (T_obj::*_A_func)(T_arg...) const volatile)
*/
template <class T_return, class T_obj, class T_obj2, class... T_arg>
inline decltype(auto)
-mem_fun(/**/ T_obj& _A_obj, T_return (T_obj2::*_A_func)(T_arg...) )
+mem_fun(/**/ T_obj& _A_obj, T_return (T_obj2::*_A_func)(T_arg...))
{
- return bound_mem_functor<
- T_return (T_obj::*)(T_arg...) ,
- T_arg...>(_A_obj, _A_func);
+ return bound_mem_functor<T_return (T_obj::*)(T_arg...), T_arg...>(_A_obj, _A_func);
}
-/** Creates a functor of type sigc::bound_const_mem_functor which encapsulates a method and an object
instance.
+/** Creates a functor of type sigc::bound_const_mem_functor which encapsulates a method and an
+ * object instance.
* @param _A_obj Reference to object instance the functor should operate on.
* @param _A_func Pointer to method that should be wrapped.
* @return Functor that executes @e _A_func on invokation.
@@ -245,13 +242,11 @@ template <class T_return, class T_obj, class T_obj2, class... T_arg>
inline decltype(auto)
mem_fun(/*const*/ T_obj& _A_obj, T_return (T_obj2::*_A_func)(T_arg...) const)
{
- return bound_mem_functor<
- T_return (T_obj::*)(T_arg...) const,
- T_arg...>(_A_obj, _A_func);
+ return bound_mem_functor<T_return (T_obj::*)(T_arg...) const, T_arg...>(_A_obj, _A_func);
}
-
-/** Creates a functor of type sigc::bound_volatile_mem_functor which encapsulates a method and an object
instance.
+/** Creates a functor of type sigc::bound_volatile_mem_functor which encapsulates a method and an
+ * object instance.
* @param _A_obj Reference to object instance the functor should operate on.
* @param _A_func Pointer to method that should be wrapped.
* @return Functor that executes @e _A_func on invokation.
@@ -262,13 +257,11 @@ template <class T_return, class T_obj, class T_obj2, class... T_arg>
inline decltype(auto)
mem_fun(/**/ T_obj& _A_obj, T_return (T_obj2::*_A_func)(T_arg...) volatile)
{
- return bound_mem_functor<
- T_return (T_obj::*)(T_arg...) volatile,
- T_arg...>(_A_obj, _A_func);
+ return bound_mem_functor<T_return (T_obj::*)(T_arg...) volatile, T_arg...>(_A_obj, _A_func);
}
-
-/** Creates a functor of type sigc::bound_const_volatile_mem_functor which encapsulates a method and an
object instance.
+/** Creates a functor of type sigc::bound_const_volatile_mem_functor which encapsulates a method and
+ * an object instance.
* @param _A_obj Reference to object instance the functor should operate on.
* @param _A_func Pointer to method that should be wrapped.
* @return Functor that executes @e _A_func on invokation.
@@ -279,12 +272,8 @@ template <class T_return, class T_obj, class T_obj2, class... T_arg>
inline decltype(auto)
mem_fun(/*const*/ T_obj& _A_obj, T_return (T_obj2::*_A_func)(T_arg...) const volatile)
{
- return bound_mem_functor<
- T_return (T_obj::*)(T_arg...) const volatile,
- T_arg...>(_A_obj, _A_func);
+ return bound_mem_functor<T_return (T_obj::*)(T_arg...) const volatile, T_arg...>(_A_obj, _A_func);
}
-
-
} /* namespace sigc */
#endif /* _SIGC_FUNCTORS_MEM_FUN_H_ */
diff --git a/sigc++/functors/ptr_fun.h b/sigc++/functors/ptr_fun.h
index 1daa1a9..ef4b36a 100644
--- a/sigc++/functors/ptr_fun.h
+++ b/sigc++/functors/ptr_fun.h
@@ -2,7 +2,8 @@
#define _SIGC_FUNCTORS_PTR_FUN_H_
#include <sigc++/type_traits.h>
-namespace sigc {
+namespace sigc
+{
/** @defgroup ptr_fun ptr_fun()
* ptr_fun() is used to convert a pointer to a function to a functor.
@@ -52,12 +53,13 @@ template <class T_return, class... T_args>
class pointer_functor;
template <class T_return, class... T_args>
-class pointer_functor<T_return(T_args...)>
- : public functor_base
+class pointer_functor<T_return(T_args...)> : public functor_base
{
using function_type = T_return (*)(T_args...);
-protected:
+
+protected:
function_type func_ptr_;
+
public:
using result_type = T_return;
@@ -67,15 +69,14 @@ public:
/** Constructs a pointer_functor2 object that wraps an existing function.
* @param _A_func Pointer to function that will be invoked from operator()().
*/
- explicit pointer_functor(function_type _A_func): func_ptr_(_A_func) {}
+ explicit pointer_functor(function_type _A_func) : func_ptr_(_A_func) {}
/** Execute the wrapped function.
* @param _A_a1 Argument to be passed on to the function.
* @param _A_a2 Argument 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_a) const
- { return func_ptr_(_A_a...); }
+ T_return operator()(type_trait_take_t<T_args>... _A_a) const { return func_ptr_(_A_a...); }
};
/** Creates a functor of type sigc::pointer_functor which wraps an existing non-member function.
@@ -85,9 +86,10 @@ public:
* @ingroup ptr_fun
*/
template <class T_return, class... T_args>
-inline decltype(auto)
-ptr_fun(T_return (*_A_func)(T_args...))
-{ return pointer_functor<T_return(T_args...)>(_A_func); }
+inline decltype(auto) ptr_fun(T_return (*_A_func)(T_args...))
+{
+ return pointer_functor<T_return(T_args...)>(_A_func);
+}
} /* namespace sigc */
#endif /* _SIGC_FUNCTORS_PTR_FUN_H_ */
diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h
index 43176a1..b658090 100644
--- a/sigc++/functors/slot.h
+++ b/sigc++/functors/slot.h
@@ -6,9 +6,11 @@
#include <sigc++/adaptors/adaptor_trait.h>
#include <sigc++/functors/slot_base.h>
-namespace sigc {
+namespace sigc
+{
-namespace internal {
+namespace internal
+{
/** A typed slot_rep.
* A typed slot_rep holds a functor that can be invoked from
@@ -36,12 +38,16 @@ public:
* @param functor The functor contained by the new slot_rep object.
*/
inline typed_slot_rep(const T_functor& functor)
- : slot_rep(nullptr, &destroy, &dup), functor_(functor)
- { sigc::visit_each_type<trackable*>(slot_do_bind(this), functor_); }
+ : slot_rep(nullptr, &destroy, &dup), functor_(functor)
+ {
+ sigc::visit_each_type<trackable*>(slot_do_bind(this), functor_);
+ }
inline typed_slot_rep(const typed_slot_rep& cl)
- : slot_rep(cl.call_, &destroy, &dup), functor_(cl.functor_)
- { sigc::visit_each_type<trackable*>(slot_do_bind(this), functor_); }
+ : slot_rep(cl.call_, &destroy, &dup), functor_(cl.functor_)
+ {
+ sigc::visit_each_type<trackable*>(slot_do_bind(this), functor_);
+ }
typed_slot_rep& operator=(const typed_slot_rep& src) = delete;
@@ -49,41 +55,37 @@ public:
typed_slot_rep& operator=(typed_slot_rep&& src) = delete;
inline ~typed_slot_rep()
- {
- call_ = nullptr;
- destroy_ = nullptr;
- sigc::visit_each_type<trackable*>(slot_do_unbind(this), functor_);
- }
+ {
+ call_ = nullptr;
+ destroy_ = nullptr;
+ sigc::visit_each_type<trackable*>(slot_do_unbind(this), functor_);
+ }
private:
/** Detaches the stored functor from the other referred trackables and destroys it.
* This does not destroy the base slot_rep object.
*/
static void destroy(notifiable* data)
- {
- self* self_ = static_cast<self*>(reinterpret_cast<slot_rep*>(data));
- self_->call_ = nullptr;
- self_->destroy_ = nullptr;
- sigc::visit_each_type<trackable*>(slot_do_unbind(self_), self_->functor_);
- self_->functor_.~adaptor_type();
- /* don't call disconnect() here: destroy() is either called
- * a) from the parent itself (in which case disconnect() leads to a segfault) or
- * b) from a parentless slot (in which case disconnect() does nothing)
- */
- }
+ {
+ self* self_ = static_cast<self*>(reinterpret_cast<slot_rep*>(data));
+ self_->call_ = nullptr;
+ self_->destroy_ = nullptr;
+ sigc::visit_each_type<trackable*>(slot_do_unbind(self_), self_->functor_);
+ self_->functor_.~adaptor_type();
+ /* don't call disconnect() here: destroy() is either called
+ * a) from the parent itself (in which case disconnect() leads to a segfault) or
+ * b) from a parentless slot (in which case disconnect() does nothing)
+ */
+ }
/** Makes a deep copy of the slot_rep object.
* Deep copy means that the notification callback of the new
* slot_rep object is registered in the referred trackables.
* @return A deep copy of the slot_rep object.
*/
- static slot_rep* dup(slot_rep* a_rep)
- {
- return new self(*static_cast<self*>(a_rep));
- }
+ static slot_rep* dup(slot_rep* a_rep) { return new self(*static_cast<self*>(a_rep)); }
};
-
/** Abstracts functor execution.
* call_it() invokes a functor of type @e T_functor with a list of
* parameters whose types are given by the template arguments.
@@ -95,7 +97,7 @@ private:
* - @e T_arg Argument types used in the definition of call_it().
*
*/
-template<class T_functor, class T_return, class... T_arg>
+template <class T_functor, class T_return, class... T_arg>
struct slot_call
{
/** Invokes a functor of type @p T_functor.
@@ -104,24 +106,20 @@ struct slot_call
* @return The return values of the functor invocation.
*/
static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg>... a_)
- {
- using typed_slot = typed_slot_rep<T_functor>;
- typed_slot *typed_rep = static_cast<typed_slot*>(rep);
- return (typed_rep->functor_).template operator()<type_trait_take_t<T_arg>...>
- (a_...);
- }
+ {
+ using typed_slot = typed_slot_rep<T_functor>;
+ typed_slot* typed_rep = static_cast<typed_slot*>(rep);
+ return (typed_rep->functor_).template operator()<type_trait_take_t<T_arg>...>(a_...);
+ }
/** Forms a function pointer from call_it().
* @return A function pointer formed from call_it().
*/
- static hook address()
- { return reinterpret_cast<hook>(&call_it); }
+ static hook address() { return reinterpret_cast<hook>(&call_it); }
};
-
} /* namespace internal */
-
// Because slot is opaque, visit_each() will not visit its internal members.
// Those members are not reachable by visit_each() after the slot has been
// constructed. But when a slot contains another slot, the outer slot will become
@@ -155,16 +153,16 @@ template <class T_return, class... T_arg>
class slot;
template <class T_return, class... T_arg>
-class slot<T_return(T_arg...)>
- : public slot_base
+class slot<T_return(T_arg...)> : public slot_base
{
public:
using result_type = T_return;
- //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:
using rep_type = internal::slot_rep;
+
public:
using call_type = T_return (*)(rep_type*, type_trait_take_t<T_arg>...);
#endif
@@ -174,11 +172,11 @@ public:
* @return The return value of the functor invocation.
*/
inline T_return operator()(type_trait_take_t<T_arg>... _A_a) const
- {
- if (!empty() && !blocked())
- return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a...);
- return T_return();
- }
+ {
+ if (!empty() && !blocked())
+ return (reinterpret_cast<call_type>(slot_base::rep_->call_))(slot_base::rep_, _A_a...);
+ return T_return();
+ }
inline slot() {}
@@ -186,27 +184,22 @@ public:
* @param _A_func The desired functor the new slot should be assigned to.
*/
template <class T_functor>
- slot(const T_functor& _A_func)
- : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
- {
- //The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
- slot_base::rep_->call_ = internal::slot_call<T_functor, T_return, T_arg...>::address();
- }
+ slot(const T_functor& _A_func) : slot_base(new internal::typed_slot_rep<T_functor>(_A_func))
+ {
+ // The slot_base:: is necessary to stop the HP-UX aCC compiler from being confused. murrayc.
+ slot_base::rep_->call_ = internal::slot_call<T_functor, T_return, T_arg...>::address();
+ }
/** Constructs a slot, copying an existing one.
* @param src The existing slot to copy.
*/
- slot(const slot& src)
- : slot_base(src)
- {}
+ slot(const slot& src) : slot_base(src) {}
/** Constructs a slot, moving an existing one.
* If @p src is connected to a parent (e.g. a signal), it is copied, not moved.
* @param src The existing slot to move or copy.
*/
- slot(slot&& src)
- : slot_base(std::move(src))
- {}
+ slot(slot&& src) : slot_base(std::move(src)) {}
/** Overrides this slot, making a copy from another slot.
* @param src The slot from which to make a copy.
@@ -231,7 +224,7 @@ public:
};
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-//template specialization of visitor<>::do_visit_each<>(action, functor):
+// template specialization of visitor<>::do_visit_each<>(action, functor):
/** Performs a functor on each of the targets of a functor.
*
* There are three function overloads for sigc::slot.
@@ -256,23 +249,24 @@ public:
template <typename T_return, typename... T_arg>
struct visitor<slot<T_return, T_arg...>>
{
- static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_bind>&
_A_action,
- const slot<T_return, T_arg...>& _A_target)
+ static void do_visit_each(
+ const internal::limit_derived_target<trackable*, internal::slot_do_bind>& _A_action,
+ const slot<T_return, T_arg...>& _A_target)
{
if (_A_target.rep_ && _A_target.rep_->parent_ == nullptr)
- _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
+ _A_target.rep_->set_parent(_A_action.action_.rep_, &internal::slot_rep::notify);
}
- static void do_visit_each(const internal::limit_derived_target<trackable*, internal::slot_do_unbind>&
_A_action,
- const slot<T_return, T_arg...>& _A_target)
+ static void do_visit_each(
+ const internal::limit_derived_target<trackable*, internal::slot_do_unbind>& _A_action,
+ const slot<T_return, T_arg...>& _A_target)
{
if (_A_target.rep_ && _A_target.rep_->parent_ == _A_action.action_.rep_)
_A_target.rep_->set_parent(nullptr, nullptr);
}
template <typename T_action>
- static void do_visit_each(const T_action& _A_action,
- const slot<T_return, T_arg...>& _A_target)
+ static void do_visit_each(const T_action& _A_action, const slot<T_return, T_arg...>& _A_target)
{
_A_action(_A_target);
}
diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h
index cd130c1..1907197 100644
--- a/sigc++/functors/slot_base.h
+++ b/sigc++/functors/slot_base.h
@@ -26,7 +26,8 @@
namespace sigc
{
-namespace internal {
+namespace internal
+{
using hook = void* (*)(void*);
@@ -63,7 +64,7 @@ struct SIGC_API slot_rep : public trackable
/* NB: Instead of slot_rep we could inherit slot_base from trackable.
* However, a simple benchmark seems to indicate that this slows
* down dereferencing of slot list iterators. Martin. */
- //TODO: Try this now? murrayc.
+ // TODO: Try this now? murrayc.
/// Callback that invokes the contained functor.
/* This can't be a virtual function since number of arguments
@@ -94,12 +95,17 @@ public:
notifiable* parent_;
inline slot_rep(hook call__, notifiable::func_destroy_notify destroy__, hook_dup dup__) noexcept
- : call_(call__), destroy_(destroy__), dup_(dup__), cleanup_(nullptr), parent_(nullptr) {}
+ : call_(call__),
+ destroy_(destroy__),
+ dup_(dup__),
+ cleanup_(nullptr),
+ parent_(nullptr)
+ {
+ }
- inline ~slot_rep()
- { destroy(); }
+ inline ~slot_rep() { destroy(); }
- // only MSVC needs this to guarantee that all new/delete are executed from the DLL module
+// only MSVC needs this to guarantee that all new/delete are executed from the DLL module
#ifdef SIGC_NEW_DELETE_IN_LIBRARY_ONLY
void* operator new(size_t size_);
void operator delete(void* p);
@@ -108,13 +114,18 @@ public:
/** Destroys the slot_rep object (but doesn't delete it).
*/
inline void destroy()
- { if (destroy_) (*destroy_)(this); }
+ {
+ if (destroy_)
+ (*destroy_)(this);
+ }
/** Makes a deep copy of the slot_rep object.
* @return A deep copy of the slot_rep object.
*/
inline slot_rep* dup() const
- { return reinterpret_cast<slot_rep*>((*dup_)(const_cast<slot_rep*>(this))); }
+ {
+ return reinterpret_cast<slot_rep*>((*dup_)(const_cast<slot_rep*>(this)));
+ }
/** Set the parent with a callback.
* slots have one parent exclusively.
@@ -122,10 +133,10 @@ public:
* @param cleanup The callback to execute from notify().
*/
inline void set_parent(notifiable* parent, notifiable::func_destroy_notify cleanup) noexcept
- {
- parent_ = parent;
- cleanup_ = cleanup;
- }
+ {
+ parent_ = parent;
+ cleanup_ = cleanup;
+ }
/// Invalidates the slot and executes the parent's cleanup callback.
void disconnect();
@@ -158,7 +169,9 @@ struct SIGC_API slot_do_bind
* @param t The trackable object to add a callback to.
*/
inline void operator()(const trackable* t) const
- { t->add_destroy_notify_callback(rep_, &slot_rep::notify); }
+ {
+ t->add_destroy_notify_callback(rep_, &slot_rep::notify);
+ }
};
/// Functor used to remove a dependency from a trackable.
@@ -175,12 +188,10 @@ struct SIGC_API slot_do_unbind
/** Removes a dependency from @p t.
* @param t The trackable object to remove the callback from.
*/
- inline void operator()(const trackable* t) const
- { t->remove_destroy_notify_callback(rep_); }
+ inline void operator()(const trackable* t) const { t->remove_destroy_notify_callback(rep_); }
};
-} //namespace internal
-
+} // namespace internal
/** @defgroup slot Slots
* Slots are type-safe representations of callback methods and functions.
@@ -300,8 +311,6 @@ public:
*/
void set_parent(notifiable* parent, notifiable::func_destroy_notify cleanup) const noexcept;
-
-
/** Add a callback that is executed (notified) when the slot is detroyed.
* This function is used internally by connection objects.
* @param data Passed into func upon notification.
@@ -318,15 +327,13 @@ public:
/** Returns whether the slot is invalid.
* @return @p true if the slot is invalid (empty).
*/
- inline bool empty() const noexcept
- { return (!rep_ || !rep_->call_); }
+ inline bool empty() const noexcept { return (!rep_ || !rep_->call_); }
/** Returns whether the slot is blocked.
* @return @p true if the slot is blocked.
*/
- inline bool blocked() const noexcept
- { return blocked_; }
-
+ inline bool blocked() const noexcept { return blocked_; }
+
/** Sets the blocking state.
* If @e should_block is @p true then the blocking state is set.
* Subsequent calls to slot::operator()() don't invoke the functor
@@ -347,9 +354,10 @@ public:
*/
void disconnect();
-//The Tru64 and Solaris Forte 5.5 compilers needs this operator=() to be public. I'm not sure why, or why it
needs to be protected usually. murrayc.
-//See bug #168265.
-//protected:
+ // The Tru64 and Solaris Forte 5.5 compilers needs this operator=() to be public. I'm not sure
+ // why, or why it needs to be protected usually. murrayc.
+ // See bug #168265.
+ // protected:
/** Overrides this slot, making a copy from another slot.
* @param src The slot from which to make a copy.
* @return @p this.
@@ -365,7 +373,7 @@ public:
public: // public to avoid template friend declarations
/** Typed slot_rep object that contains a functor. */
- mutable rep_type *rep_;
+ mutable rep_type* rep_;
/** Indicates whether the slot is blocked. */
bool blocked_;
@@ -374,7 +382,6 @@ private:
void delete_rep_with_check();
};
-} //namespace sigc
+} // namespace sigc
#endif //_SIGC_SLOT_BASE_HPP_
-
diff --git a/sigc++/limit_reference.h b/sigc++/limit_reference.h
index ba056b8..9167d87 100644
--- a/sigc++/limit_reference.h
+++ b/sigc++/limit_reference.h
@@ -5,7 +5,8 @@
#include <sigc++/type_traits.h>
#include <sigc++/trackable.h>
-namespace sigc {
+namespace sigc
+{
/** A limit_reference<Foo> object stores a reference (Foo&), but makes sure that,
* if Foo inherits from sigc::trackable, then visit_each<>() will "limit" itself to the
@@ -28,8 +29,7 @@ namespace sigc {
* - @e T_type The type of the reference.
*/
template <class T_type,
- bool I_derives_trackable =
- std::is_base_of<trackable, std::decay_t<T_type>>::value>
+ bool I_derives_trackable = std::is_base_of<trackable, std::decay_t<T_type>>::value>
class limit_reference
{
public:
@@ -38,23 +38,20 @@ public:
/** Constructor.
* @param _A_target The reference to limit.
*/
- limit_reference(reference_type& _A_target)
- : visited(_A_target)
- {}
+ limit_reference(reference_type& _A_target) : visited(_A_target) {}
/** Retrieve the entity to visit for visit_each().
- * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if
T_type derives from sigc::trackable.
+ * Depending on the template specialization, this is either a derived reference, or
+ * sigc::trackable& if T_type derives from sigc::trackable.
* @return The reference.
*/
- inline const reference_type& visit() const
- { return visited; }
+ inline const reference_type& visit() const { return visited; }
/** Retrieve the reference.
* This is always a reference to the derived instance.
* @return The reference.
*/
- inline T_type& invoke() const
- { return visited; }
+ inline T_type& invoke() const { return visited; }
private:
/** The reference.
@@ -74,28 +71,24 @@ public:
/** Constructor.
* @param _A_target The reference to limit.
*/
- limit_reference(reference_type& _A_target)
- : visited(_A_target),
- invoked(_A_target)
- {}
+ limit_reference(reference_type& _A_target) : visited(_A_target), invoked(_A_target) {}
/** Retrieve the entity to visit for visit_each().
- * Depending on the template specialization, this is either a derived reference, or sigc::trackable& if
T_type derives from sigc::trackable.
+ * Depending on the template specialization, this is either a derived reference, or
+ * sigc::trackable& if T_type derives from sigc::trackable.
* @return The reference.
*/
- inline const trackable& visit() const
- { return visited; }
+ inline const trackable& visit() const { return visited; }
/** Retrieve the reference.
* This is always a reference to the derived instance.
* @return The reference.
*/
- inline T_type& invoke() const
- { return invoked; }
+ inline T_type& invoke() const { return invoked; }
private:
- using trackable_type = typename std::conditional_t<
- std::is_const<reference_type>::value, const trackable, trackable>;
+ using trackable_type =
+ typename std::conditional_t<std::is_const<reference_type>::value, const trackable, trackable>;
/** The trackable reference.
*/
@@ -116,11 +109,10 @@ private:
* @param _A_target The visited instance.
*/
template <class T_type>
-struct visitor<limit_reference<T_type> >
+struct visitor<limit_reference<T_type>>
{
template <class T_action>
- static void do_visit_each(const T_action& _A_action,
- const limit_reference<T_type>& _A_target)
+ static void do_visit_each(const T_action& _A_action, const limit_reference<T_type>& _A_target)
{
sigc::visit_each(_A_action, _A_target.visit());
}
diff --git a/sigc++/member_method_trait.h b/sigc++/member_method_trait.h
index 3c07f1c..cd6cc32 100644
--- a/sigc++/member_method_trait.h
+++ b/sigc++/member_method_trait.h
@@ -21,10 +21,11 @@
#include <sigc++config.h>
+namespace sigc
+{
-namespace sigc {
-
-namespace internal {
+namespace internal
+{
template <class>
struct member_method_is_const;
@@ -53,7 +54,6 @@ struct member_method_is_const<T_result (T_obj::*)(T_arg...) const volatile>
constexpr static bool value = true;
};
-
template <class>
struct member_method_is_volatile;
@@ -81,8 +81,7 @@ struct member_method_is_volatile<T_result (T_obj::*)(T_arg...) const volatile>
constexpr static bool value = true;
};
-
-//member method class:
+// member method class:
template <class T_result, class... T_arg>
struct member_method_class
@@ -90,31 +89,30 @@ struct member_method_class
};
template <class T_obj, class T_result, class... T_arg>
-struct member_method_class<T_result(T_obj::*)(T_arg...)>
+struct member_method_class<T_result (T_obj::*)(T_arg...)>
{
using type = T_obj;
};
template <class T_obj, class T_result, class... T_arg>
-struct member_method_class<T_result(T_obj::*)(T_arg...) volatile>
+struct member_method_class<T_result (T_obj::*)(T_arg...) volatile>
{
using type = T_obj;
};
template <class T_obj, class T_result, class... T_arg>
-struct member_method_class<T_result(T_obj::*)(T_arg...) const>
+struct member_method_class<T_result (T_obj::*)(T_arg...) const>
{
using type = T_obj;
};
template <class T_obj, class T_result, class... T_arg>
-struct member_method_class<T_result(T_obj::*)(T_arg...) const volatile>
+struct member_method_class<T_result (T_obj::*)(T_arg...) const volatile>
{
using type = T_obj;
};
-
-//member method result:
+// member method result:
template <class T_result, class... T_arg>
struct member_method_result
@@ -122,25 +120,25 @@ struct member_method_result
};
template <class T_obj, class T_result, class... T_arg>
-struct member_method_result<T_result(T_obj::*)(T_arg...)>
+struct member_method_result<T_result (T_obj::*)(T_arg...)>
{
using type = T_result;
};
template <class T_obj, class T_result, class... T_arg>
-struct member_method_result<T_result(T_obj::*)(T_arg...) volatile>
+struct member_method_result<T_result (T_obj::*)(T_arg...) volatile>
{
using type = T_result;
};
template <class T_obj, class T_result, class... T_arg>
-struct member_method_result<T_result(T_obj::*)(T_arg...) const>
+struct member_method_result<T_result (T_obj::*)(T_arg...) const>
{
using type = T_result;
};
template <class T_obj, class T_result, class... T_arg>
-struct member_method_result<T_result(T_obj::*)(T_arg...) const volatile>
+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 7dc0790..f6c2fb2 100644
--- a/sigc++/reference_wrapper.h
+++ b/sigc++/reference_wrapper.h
@@ -19,7 +19,8 @@
#ifndef _SIGC_REFERENCE_WRAPPER_H_
#define _SIGC_REFERENCE_WRAPPER_H_
-namespace sigc {
+namespace sigc
+{
template <class T_type>
struct unwrap_reference
@@ -28,24 +29,30 @@ struct unwrap_reference
};
template <class T_type>
-struct unwrap_reference<std::reference_wrapper<T_type> >
+struct unwrap_reference<std::reference_wrapper<T_type>>
{
using type = T_type&;
};
template <class T_type>
-struct unwrap_reference<std::reference_wrapper<const T_type> >
+struct unwrap_reference<std::reference_wrapper<const T_type>>
{
using type = const T_type&;
};
template <class T_type>
-T_type& unwrap(const std::reference_wrapper<T_type>& v)
-{ return v; }
+T_type&
+unwrap(const std::reference_wrapper<T_type>& v)
+{
+ return v;
+}
template <class T_type>
-const T_type& unwrap(const std::reference_wrapper<const T_type>& v)
-{ return v; }
+const T_type&
+unwrap(const std::reference_wrapper<const T_type>& v)
+{
+ return v;
+}
} /* namespace sigc */
diff --git a/sigc++/retype_return.h b/sigc++/retype_return.h
index c1d08d7..8f0837b 100644
--- a/sigc++/retype_return.h
+++ b/sigc++/retype_return.h
@@ -21,5 +21,4 @@
#include <sigc++/adaptors/retype_return.h>
-
#endif /* _SIGC_RETYPE_RETURN_HPP_ */
diff --git a/sigc++/sigc++.h b/sigc++/sigc++.h
index 54c07d4..bbe095c 100644
--- a/sigc++/sigc++.h
+++ b/sigc++/sigc++.h
@@ -24,24 +24,26 @@
*
* @section description Description
*
- * libsigc++ provides a typesafe (at compile time) callback system for standard
- * C++. It allows you to define signals and to connect those signals to any
- * callback function, either a global or a member function, regardless of whether
- * it is static or virtual. It also contains adaptor classes for connection of
+ * libsigc++ provides a typesafe (at compile time) callback system for standard
+ * C++. It allows you to define signals and to connect those signals to any
+ * callback function, either a global or a member function, regardless of whether
+ * it is static or virtual. It also contains adaptor classes for connection of
* dissimilar callbacks.
*
- * For instance, see the @ref signal "Signals", @ref sigcfunctors "Functors",
+ * For instance, see the @ref signal "Signals", @ref sigcfunctors "Functors",
* @ref slot "Slots" and @ref adaptors "Adaptors".
*
- * See also the
- * <a href="http://libsigc.sourceforge.net/libsigc2/docs/manual/html/index.html">libsigc++ tutorial</a>,
- * the <a href="http://libsigc.sourceforge.net/">libsigc++ website</a>, and
- * the <a href="http://library.gnome.org/devel/gtkmm-tutorial/unstable/chapter-signals.html">Signals
appendix of the Programming with gtkmm book</a>.
+ * See also the
+ * <a href="http://libsigc.sourceforge.net/libsigc2/docs/manual/html/index.html">libsigc++
+ * tutorial</a>,
+ * the <a href="http://libsigc.sourceforge.net/">libsigc++ website</a>, and
+ * the <a href="http://library.gnome.org/devel/gtkmm-tutorial/unstable/chapter-signals.html">Signals
+ * appendix of the Programming with gtkmm book</a>.
*
* @section features Features
*
* - Compile-time typesafe callbacks (also faster than run time checks)
- * - Type-safety violations report the line number correctly with template names
+ * - Type-safety violations report the line number correctly with template names
* (no tracing template failures into headers)
* - No compiler extensions or meta compilers required
* - Proper handling of dynamic objects and signals (deleted objects will not
diff --git a/sigc++/signal.h b/sigc++/signal.h
index 6df4207..cd87b35 100644
--- a/sigc++/signal.h
+++ b/sigc++/signal.h
@@ -29,7 +29,8 @@
#include <tuple>
#include <utility>
-namespace sigc {
+namespace sigc
+{
/** STL-style iterator for slot_list.
*
@@ -50,49 +51,43 @@ struct slot_iterator
using iterator_type = typename internal::signal_impl::iterator_type;
- slot_iterator()
- {}
+ slot_iterator() {}
- explicit slot_iterator(const iterator_type& i)
- : i_(i) {}
+ explicit slot_iterator(const iterator_type& i) : i_(i) {}
- reference operator*() const
- { return static_cast<reference>(*i_); }
+ reference operator*() const { return static_cast<reference>(*i_); }
- pointer operator->() const
- { return &(operator*()); }
+ pointer operator->() const { return &(operator*()); }
slot_iterator& operator++()
- {
- ++i_;
- return *this;
- }
+ {
+ ++i_;
+ return *this;
+ }
slot_iterator operator++(int)
- {
- slot_iterator __tmp(*this);
- ++i_;
- return __tmp;
- }
+ {
+ slot_iterator __tmp(*this);
+ ++i_;
+ return __tmp;
+ }
slot_iterator& operator--()
- {
- --i_;
- return *this;
- }
+ {
+ --i_;
+ return *this;
+ }
slot_iterator operator--(int)
- {
- slot_iterator __tmp(*this);
- --i_;
- return __tmp;
- }
+ {
+ slot_iterator __tmp(*this);
+ --i_;
+ return __tmp;
+ }
- bool operator == (const slot_iterator& other) const
- { return i_ == other.i_; }
+ bool operator==(const slot_iterator& other) const { return i_ == other.i_; }
- bool operator != (const slot_iterator& other) const
- { return i_ != other.i_; }
+ bool operator!=(const slot_iterator& other) const { return i_ != other.i_; }
iterator_type i_;
};
@@ -116,49 +111,43 @@ struct slot_const_iterator
using iterator_type = typename internal::signal_impl::const_iterator_type;
- slot_const_iterator()
- {}
+ slot_const_iterator() {}
- explicit slot_const_iterator(const iterator_type& i)
- : i_(i) {}
+ explicit slot_const_iterator(const iterator_type& i) : i_(i) {}
- reference operator*() const
- { return static_cast<reference>(*i_); }
+ reference operator*() const { return static_cast<reference>(*i_); }
- pointer operator->() const
- { return &(operator*()); }
+ pointer operator->() const { return &(operator*()); }
slot_const_iterator& operator++()
- {
- ++i_;
- return *this;
- }
+ {
+ ++i_;
+ return *this;
+ }
slot_const_iterator operator++(int)
- {
- slot_const_iterator __tmp(*this);
- ++i_;
- return __tmp;
- }
+ {
+ slot_const_iterator __tmp(*this);
+ ++i_;
+ return __tmp;
+ }
slot_const_iterator& operator--()
- {
- --i_;
- return *this;
- }
+ {
+ --i_;
+ return *this;
+ }
slot_const_iterator operator--(int)
- {
- slot_const_iterator __tmp(*this);
- --i_;
- return __tmp;
- }
+ {
+ slot_const_iterator __tmp(*this);
+ --i_;
+ return __tmp;
+ }
- bool operator == (const slot_const_iterator& other) const
- { return i_ == other.i_; }
+ bool operator==(const slot_const_iterator& other) const { return i_ == other.i_; }
- bool operator != (const slot_const_iterator& other) const
- { return i_ != other.i_; }
+ bool operator!=(const slot_const_iterator& other) const { return i_ != other.i_; }
iterator_type i_;
};
@@ -181,95 +170,79 @@ struct slot_list
using iterator = slot_iterator<slot_type>;
using const_iterator = slot_const_iterator<slot_type>;
-
+
using reverse_iterator = std::reverse_iterator<iterator>;
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
- slot_list()
- : list_(nullptr) {}
+ slot_list() : list_(nullptr) {}
- explicit slot_list(internal::signal_impl* __list)
- : list_(__list) {}
+ explicit slot_list(internal::signal_impl* __list) : list_(__list) {}
- iterator begin()
- { return iterator(list_->slots_.begin()); }
+ iterator begin() { return iterator(list_->slots_.begin()); }
- const_iterator begin() const
- { return const_iterator(list_->slots_.begin()); }
+ const_iterator begin() const { return const_iterator(list_->slots_.begin()); }
- iterator end()
- { return iterator(list_->slots_.end()); }
+ iterator end() { return iterator(list_->slots_.end()); }
- const_iterator end() const
- { return const_iterator(list_->slots_.end()); }
+ const_iterator end() const { return const_iterator(list_->slots_.end()); }
- reverse_iterator rbegin()
- { return reverse_iterator(end()); }
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
- const_reverse_iterator rbegin() const
- { return const_reverse_iterator(end()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
- reverse_iterator rend()
- { return reverse_iterator(begin()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
- const_reverse_iterator rend() const
- { return const_reverse_iterator(begin()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
- reference front()
- { return *begin(); }
+ reference front() { return *begin(); }
- const_reference front() const
- { return *begin(); }
+ const_reference front() const { return *begin(); }
- reference back()
- { return *(--end()); }
+ reference back() { return *(--end()); }
- const_reference back() const
- { return *(--end()); }
+ const_reference back() const { return *(--end()); }
iterator insert(iterator i, const slot_type& slot_)
- { return iterator(list_->insert(i.i_, static_cast<const slot_base&>(slot_))); }
+ {
+ return iterator(list_->insert(i.i_, static_cast<const slot_base&>(slot_)));
+ }
iterator insert(iterator i, slot_type&& slot_)
- { return iterator(list_->insert(i.i_, std::move(static_cast<slot_base&>(slot_)))); }
+ {
+ return iterator(list_->insert(i.i_, std::move(static_cast<slot_base&>(slot_))));
+ }
- void push_front(const slot_type& c)
- { insert(begin(), c); }
+ void push_front(const slot_type& c) { insert(begin(), c); }
- void push_front(slot_type&& c)
- { insert(begin(), std::move(c)); }
+ void push_front(slot_type&& c) { insert(begin(), std::move(c)); }
- void push_back(const slot_type& c)
- { insert(end(), c); }
+ void push_back(const slot_type& c) { insert(end(), c); }
- void push_back(slot_type&& c)
- { insert(end(), std::move(c)); }
+ void push_back(slot_type&& c) { insert(end(), std::move(c)); }
- iterator erase(iterator i)
- { return iterator(list_->erase(i.i_)); }
+ iterator erase(iterator i) { return iterator(list_->erase(i.i_)); }
iterator erase(iterator first_, iterator last_)
- {
- while (first_ != last_)
- first_ = erase(first_);
- return last_;
- }
+ {
+ while (first_ != last_)
+ first_ = erase(first_);
+ return last_;
+ }
- void pop_front()
- { erase(begin()); }
+ void pop_front() { erase(begin()); }
void pop_back()
- {
- auto tmp_ = end();
- erase(--tmp_);
- }
+ {
+ auto tmp_ = end();
+ erase(--tmp_);
+ }
protected:
internal::signal_impl* list_;
};
-
-namespace internal {
+namespace internal
+{
/** Special iterator over sigc::internal::signal_impl's slot list that holds extra data.
* This iterators is for use in accumulators. operator*() executes
@@ -283,8 +256,8 @@ struct slot_iterator_buf
using difference_type = std::ptrdiff_t;
using iterator_category = std::bidirectional_iterator_tag;
- //These are needed just to make this a proper C++ iterator,
- //that can be used with standard C++ algorithms.
+ // These are needed just to make this a proper C++ iterator,
+ // that can be used with standard C++ algorithms.
using value_type = T_result;
using reference = T_result&;
using pointer = T_result*;
@@ -295,60 +268,61 @@ struct slot_iterator_buf
using iterator_type = signal_impl::const_iterator_type;
- slot_iterator_buf()
- : c_(nullptr), invoked_(false) {}
+ slot_iterator_buf() : c_(nullptr), invoked_(false) {}
- slot_iterator_buf(const iterator_type& i, const emitter_type* c)
- : i_(i), c_(c), invoked_(false) {}
+ slot_iterator_buf(const iterator_type& i, const emitter_type* c) : i_(i), c_(c), invoked_(false)
+ {
+ }
decltype(auto) operator*() const
+ {
+ if (!i_->empty() && !i_->blocked() && !invoked_)
{
- if (!i_->empty() && !i_->blocked() && !invoked_)
- {
- r_ = (*c_)(static_cast<const slot_type&>(*i_));
- invoked_ = true;
- }
- return r_;
+ r_ = (*c_)(static_cast<const slot_type&>(*i_));
+ invoked_ = true;
}
+ return r_;
+ }
slot_iterator_buf& operator++()
- {
- ++i_;
- invoked_ = false;
- return *this;
- }
+ {
+ ++i_;
+ invoked_ = false;
+ return *this;
+ }
slot_iterator_buf operator++(int)
- {
- slot_iterator_buf __tmp(*this);
- ++i_;
- invoked_ = false;
- return __tmp;
- }
+ {
+ slot_iterator_buf __tmp(*this);
+ ++i_;
+ invoked_ = false;
+ return __tmp;
+ }
slot_iterator_buf& operator--()
- {
- --i_;
- invoked_ = false;
- return *this;
- }
+ {
+ --i_;
+ invoked_ = false;
+ return *this;
+ }
slot_iterator_buf operator--(int)
- {
- slot_iterator_buf __tmp(*this);
- --i_;
- invoked_ = false;
- return __tmp;
- }
+ {
+ slot_iterator_buf __tmp(*this);
+ --i_;
+ invoked_ = false;
+ return __tmp;
+ }
- bool operator == (const slot_iterator_buf& other) const
- { return (!c_ || (i_ == other.i_)); } /* If '!c_' the iterators are empty.
- * Unfortunately, empty stl iterators are not equal.
- * We are forcing equality so that 'first==last'
- * in the accumulator's emit function yields true. */
+ bool operator==(const slot_iterator_buf& other) const
+ {
+ return (!c_ || (i_ == other.i_));
+ } /* If '!c_' the iterators are empty.
+ * Unfortunately, empty stl iterators are not equal.
+ * We are forcing equality so that 'first==last'
+ * in the accumulator's emit function yields true. */
- bool operator != (const slot_iterator_buf& other) const
- { return (c_ && (i_ != other.i_)); }
+ bool operator!=(const slot_iterator_buf& other) const { return (c_ && (i_ != other.i_)); }
private:
iterator_type i_;
@@ -372,56 +346,54 @@ struct slot_iterator_buf<T_emitter, void>
using iterator_type = signal_impl::const_iterator_type;
- slot_iterator_buf()
- : c_(nullptr), invoked_(false) {}
+ slot_iterator_buf() : c_(nullptr), invoked_(false) {}
- slot_iterator_buf(const iterator_type& i, const emitter_type* c)
- : i_(i), c_(c), invoked_(false) {}
+ slot_iterator_buf(const iterator_type& i, const emitter_type* c) : i_(i), c_(c), invoked_(false)
+ {
+ }
void operator*() const
+ {
+ if (!i_->empty() && !i_->blocked() && !invoked_)
{
- if (!i_->empty() && !i_->blocked() && !invoked_)
- {
- (*c_)(static_cast<const slot_type&>(*i_));
- invoked_ = true;
- }
+ (*c_)(static_cast<const slot_type&>(*i_));
+ invoked_ = true;
}
+ }
slot_iterator_buf& operator++()
- {
- ++i_;
- invoked_ = false;
- return *this;
- }
+ {
+ ++i_;
+ invoked_ = false;
+ return *this;
+ }
slot_iterator_buf operator++(int)
- {
- slot_iterator_buf __tmp(*this);
- ++i_;
- invoked_ = false;
- return __tmp;
- }
+ {
+ slot_iterator_buf __tmp(*this);
+ ++i_;
+ invoked_ = false;
+ return __tmp;
+ }
slot_iterator_buf& operator--()
- {
- --i_;
- invoked_ = false;
- return *this;
- }
+ {
+ --i_;
+ invoked_ = false;
+ return *this;
+ }
slot_iterator_buf operator--(int)
- {
- slot_iterator_buf __tmp(*this);
- --i_;
- invoked_ = false;
- return __tmp;
- }
+ {
+ slot_iterator_buf __tmp(*this);
+ --i_;
+ invoked_ = false;
+ return __tmp;
+ }
- bool operator == (const slot_iterator_buf& other) const
- { return i_ == other.i_; }
+ bool operator==(const slot_iterator_buf& other) const { return i_ == other.i_; }
- bool operator != (const slot_iterator_buf& other) const
- { return i_ != other.i_; }
+ bool operator!=(const slot_iterator_buf& other) const { return i_ != other.i_; }
private:
iterator_type i_;
@@ -437,8 +409,8 @@ struct slot_reverse_iterator_buf
using difference_type = std::ptrdiff_t;
using iterator_category = std::bidirectional_iterator_tag;
- //These are needed just to make this a proper C++ iterator,
- //that can be used with standard C++ algorithms.
+ // These are needed just to make this a proper C++ iterator,
+ // that can be used with standard C++ algorithms.
using value_type = T_result;
using reference = T_result&;
using pointer = T_result*;
@@ -449,62 +421,64 @@ struct slot_reverse_iterator_buf
using iterator_type = signal_impl::const_iterator_type;
- slot_reverse_iterator_buf()
- : c_(nullptr), invoked_(false) {}
+ slot_reverse_iterator_buf() : c_(nullptr), invoked_(false) {}
slot_reverse_iterator_buf(const iterator_type& i, const emitter_type* c)
- : i_(i), c_(c), invoked_(false) {}
+ : i_(i), c_(c), invoked_(false)
+ {
+ }
decltype(auto) operator*() const
+ {
+ iterator_type __tmp(i_);
+ --__tmp;
+ if (!__tmp->empty() && !__tmp->blocked() && !invoked_)
{
- iterator_type __tmp(i_);
- --__tmp;
- if (!__tmp->empty() && !__tmp->blocked() && !invoked_)
- {
- r_ = (*c_)(static_cast<const slot_type&>(*__tmp));
- invoked_ = true;
- }
- return r_;
+ r_ = (*c_)(static_cast<const slot_type&>(*__tmp));
+ invoked_ = true;
}
+ return r_;
+ }
slot_reverse_iterator_buf& operator++()
- {
- --i_;
- invoked_ = false;
- return *this;
- }
+ {
+ --i_;
+ invoked_ = false;
+ return *this;
+ }
slot_reverse_iterator_buf operator++(int)
- {
- slot_reverse_iterator_buf __tmp(*this);
- --i_;
- invoked_ = false;
- return __tmp;
- }
+ {
+ slot_reverse_iterator_buf __tmp(*this);
+ --i_;
+ invoked_ = false;
+ return __tmp;
+ }
slot_reverse_iterator_buf& operator--()
- {
- ++i_;
- invoked_ = false;
- return *this;
- }
+ {
+ ++i_;
+ invoked_ = false;
+ return *this;
+ }
slot_reverse_iterator_buf operator--(int)
- {
- slot_reverse_iterator_buf __tmp(*this);
- ++i_;
- invoked_ = false;
- return __tmp;
- }
+ {
+ slot_reverse_iterator_buf __tmp(*this);
+ ++i_;
+ invoked_ = false;
+ return __tmp;
+ }
- bool operator == (const slot_reverse_iterator_buf& other) const
- { return (!c_ || (i_ == other.i_)); } /* If '!c_' the iterators are empty.
- * Unfortunately, empty stl iterators are not equal.
- * We are forcing equality so that 'first==last'
- * in the accumulator's emit function yields true. */
+ bool operator==(const slot_reverse_iterator_buf& other) const
+ {
+ return (!c_ || (i_ == other.i_));
+ } /* If '!c_' the iterators are empty.
+ * Unfortunately, empty stl iterators are not equal.
+ * We are forcing equality so that 'first==last'
+ * in the accumulator's emit function yields true. */
- bool operator != (const slot_reverse_iterator_buf& other) const
- { return (c_ && (i_ != other.i_)); }
+ bool operator!=(const slot_reverse_iterator_buf& other) const { return (c_ && (i_ != other.i_)); }
private:
iterator_type i_;
@@ -528,58 +502,57 @@ struct slot_reverse_iterator_buf<T_emitter, void>
using iterator_type = signal_impl::const_iterator_type;
- slot_reverse_iterator_buf()
- : c_(nullptr), invoked_(false) {}
+ slot_reverse_iterator_buf() : c_(nullptr), invoked_(false) {}
slot_reverse_iterator_buf(const iterator_type& i, const emitter_type* c)
- : i_(i), c_(c), invoked_(false) {}
+ : i_(i), c_(c), invoked_(false)
+ {
+ }
void operator*() const
+ {
+ iterator_type __tmp(i_);
+ --__tmp;
+ if (!__tmp->empty() && !__tmp->blocked() && !invoked_)
{
- iterator_type __tmp(i_);
- --__tmp;
- if (!__tmp->empty() && !__tmp->blocked() && !invoked_)
- {
- (*c_)(static_cast<const slot_type&>(*__tmp));
- invoked_ = true;
- }
+ (*c_)(static_cast<const slot_type&>(*__tmp));
+ invoked_ = true;
}
+ }
slot_reverse_iterator_buf& operator++()
- {
- --i_;
- invoked_ = false;
- return *this;
- }
+ {
+ --i_;
+ invoked_ = false;
+ return *this;
+ }
slot_reverse_iterator_buf operator++(int)
- {
- slot_reverse_iterator_buf __tmp(*this);
- --i_;
- invoked_ = false;
- return __tmp;
- }
+ {
+ slot_reverse_iterator_buf __tmp(*this);
+ --i_;
+ invoked_ = false;
+ return __tmp;
+ }
slot_reverse_iterator_buf& operator--()
- {
- ++i_;
- invoked_ = false;
- return *this;
- }
+ {
+ ++i_;
+ invoked_ = false;
+ return *this;
+ }
slot_reverse_iterator_buf operator--(int)
- {
- slot_reverse_iterator_buf __tmp(*this);
- ++i_;
- invoked_ = false;
- return __tmp;
- }
+ {
+ slot_reverse_iterator_buf __tmp(*this);
+ ++i_;
+ invoked_ = false;
+ return __tmp;
+ }
- bool operator == (const slot_reverse_iterator_buf& other) const
- { return i_ == other.i_; }
+ bool operator==(const slot_reverse_iterator_buf& other) const { return i_ == other.i_; }
- bool operator != (const slot_reverse_iterator_buf& other) const
- { return i_ != other.i_; }
+ bool operator!=(const slot_reverse_iterator_buf& other) const { return i_ != other.i_; }
private:
iterator_type i_;
@@ -587,7 +560,6 @@ private:
mutable bool invoked_;
};
-
/** Abstracts signal emission.
* This template implements the emit() function of signal_with_accumulator.
* Template specializations are available to optimize signal
@@ -608,18 +580,17 @@ struct signal_emit
* The parameters are stored in member variables. operator()() passes
* the values on to some slot.
*/
- signal_emit(type_trait_take_t<T_arg>... _A_a)
- : _A_a_(_A_a...) {}
+ signal_emit(type_trait_take_t<T_arg>... _A_a) : _A_a_(_A_a...) {}
/** Invokes a slot using the buffered parameter values.
* @param _A_slot Some slot to invoke.
* @return The slot's return value.
*/
T_return operator()(const slot_type& _A_slot) const
- {
- const auto seq = std::make_index_sequence<std::tuple_size<decltype(_A_a_)>::value>();
- return call_call_type_operator_parentheses_with_tuple(_A_slot, _A_a_, seq);
- }
+ {
+ const auto seq = std::make_index_sequence<std::tuple_size<decltype(_A_a_)>::value>();
+ return call_call_type_operator_parentheses_with_tuple(_A_slot, _A_a_, seq);
+ }
/** Executes a list of slots using an accumulator of type @e T_accumulator.
* The arguments are buffered in a temporary instance of signal_emit.
@@ -627,48 +598,48 @@ struct signal_emit
* @return The accumulated return values of the slot invocations as processed by the accumulator.
*/
static decltype(auto) emit(signal_impl* impl, type_trait_take_t<T_arg>... _A_a)
- {
- T_accumulator accumulator;
+ {
+ T_accumulator accumulator;
- if (!impl)
- return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type());
+ if (!impl)
+ return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type());
- signal_exec exec(impl);
- temp_slot_list slots(impl->slots_);
+ signal_exec exec(impl);
+ temp_slot_list slots(impl->slots_);
- self_type self(_A_a...);
- return accumulator(slot_iterator_buf_type(slots.begin(), &self),
- slot_iterator_buf_type(slots.end(), &self));
- }
+ self_type self(_A_a...);
+ return accumulator(
+ slot_iterator_buf_type(slots.begin(), &self), slot_iterator_buf_type(slots.end(), &self));
+ }
- /** Executes a list of slots using an accumulator of type @e T_accumulator in reverse order. * The
arguments are buffered in a temporary instance of signal_emit.
+ /** Executes a list of slots using an accumulator of type @e T_accumulator in reverse order. *
+ * The arguments are buffered in a temporary instance of signal_emit.
* @param _A_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_reverse(signal_impl* impl, type_trait_take_t<T_arg>... _A_a)
- {
- T_accumulator accumulator;
+ {
+ T_accumulator accumulator;
- if (!impl)
- return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type());
+ if (!impl)
+ return accumulator(slot_iterator_buf_type(), slot_iterator_buf_type());
- signal_exec exec(impl);
- temp_slot_list slots(impl->slots_);
+ signal_exec exec(impl);
+ temp_slot_list slots(impl->slots_);
- self_type self(_A_a...);
- return accumulator(slot_reverse_iterator_buf_type(slots.end(), &self),
- slot_reverse_iterator_buf_type(slots.begin(), &self));
- }
+ self_type self(_A_a...);
+ return accumulator(slot_reverse_iterator_buf_type(slots.end(), &self),
+ slot_reverse_iterator_buf_type(slots.begin(), &self));
+ }
std::tuple<type_trait_take_t<T_arg>...> _A_a_;
private:
- //TODO_variadic: Replace this with std::experimental::apply() if that becomes standard
- //C++, or add our own implementation, to avoid code duplication.
- template<std::size_t... Is>
- decltype(auto)
- call_call_type_operator_parentheses_with_tuple(const slot_type& _A_slot, const std::tuple<T_arg...>& tuple,
- std::index_sequence<Is...>) const
+ // TODO_variadic: Replace this with std::experimental::apply() if that becomes standard
+ // C++, or add our own implementation, to avoid code duplication.
+ template <std::size_t... Is>
+ decltype(auto) call_call_type_operator_parentheses_with_tuple(
+ const slot_type& _A_slot, const std::tuple<T_arg...>& tuple, std::index_sequence<Is...>) const
{
return (_A_slot)(std::get<Is>(tuple)...);
}
@@ -691,77 +662,82 @@ struct signal_emit<T_return, void, T_arg...>
* The arguments are passed directly on to the slots.
* The return value of the last slot invoked is returned.
* @param first An iterator pointing to the first slot in the list.
- * @param last An iterator pointing to the last slot in the list. * @param _A_a Arguments to be passed
on to the slots.
+ * @param last An iterator pointing to the last slot in the list. * @param _A_a Arguments to be
+ * passed on to the slots.
* @return The return value of the last slot invoked.
*/
static decltype(auto) emit(signal_impl* impl, type_trait_take_t<T_arg>... _A_a)
+ {
+ if (!impl || impl->slots_.empty())
+ return T_return();
+
+ signal_exec exec(impl);
+ T_return r_ = T_return();
+
+ // Use this scope to make sure that "slots" is destroyed before "exec" is destroyed.
+ // This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249
{
- if (!impl || impl->slots_.empty())
- return T_return();
-
- signal_exec exec(impl);
- T_return r_ = T_return();
-
- //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed.
- //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249
- {
- temp_slot_list slots(impl->slots_);
- iterator_type it = slots.begin();
- for (; it != slots.end(); ++it)
- if (!it->empty() && !it->blocked()) break;
-
- if (it == slots.end())
- return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and
initialize as follows:
-
+ temp_slot_list slots(impl->slots_);
+ iterator_type it = slots.begin();
+ for (; it != slots.end(); ++it)
+ if (!it->empty() && !it->blocked())
+ break;
+
+ if (it == slots.end())
+ return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line
+ // and initialize as follows:
+
+ r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
+ for (++it; it != slots.end(); ++it)
+ {
+ if (it->empty() || it->blocked())
+ continue;
r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
- for (++it; it != slots.end(); ++it)
- {
- if (it->empty() || it->blocked())
- continue;
- r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
- }
}
-
- return r_;
}
+ return r_;
+ }
+
/** Executes a list of slots using an accumulator of type @e T_accumulator in reverse order.
* The arguments are passed directly on to the slots.
* @param _A_a%1 Argument to be passed on to the slots.
* @return The return value of the last slot invoked.
*/
static decltype(auto) emit_reverse(signal_impl* impl, type_trait_take_t<T_arg>... _A_a)
+ {
+ if (!impl || impl->slots_.empty())
+ return T_return();
+
+ signal_exec exec(impl);
+ T_return r_ = T_return();
+
+ // Use this scope to make sure that "slots" is destroyed before "exec" is destroyed.
+ // This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249
{
- if (!impl || impl->slots_.empty())
- return T_return();
-
- signal_exec exec(impl);
- T_return r_ = T_return();
-
- //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed.
- //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249
- {
- using reverse_iterator_type = std::reverse_iterator<signal_impl::iterator_type>;
-
- temp_slot_list slots(impl->slots_);
- reverse_iterator_type it(slots.end());
- for (; it != reverse_iterator_type(slots.begin()); ++it)
- if (!it->empty() && !it->blocked()) break;
-
- if (it == reverse_iterator_type(slots.begin()))
- return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line and
initialize as follows:
-
+ using reverse_iterator_type = std::reverse_iterator<signal_impl::iterator_type>;
+
+ temp_slot_list slots(impl->slots_);
+ reverse_iterator_type it(slots.end());
+ for (; it != reverse_iterator_type(slots.begin()); ++it)
+ if (!it->empty() && !it->blocked())
+ break;
+
+ if (it == reverse_iterator_type(slots.begin()))
+ return T_return(); // note that 'T_return r_();' doesn't work => define 'r_' after this line
+ // and initialize as follows:
+
+ r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
+ for (++it; it != reverse_iterator_type(slots.begin()); ++it)
+ {
+ if (it->empty() || it->blocked())
+ continue;
r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
- for (++it; it != reverse_iterator_type(slots.begin()); ++it)
- {
- if (it->empty() || it->blocked())
- continue;
- r_ = (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
- }
}
-
- return r_;
}
+
+ return r_;
+ }
};
/** Abstracts signal emission.
@@ -778,49 +754,52 @@ struct signal_emit<void, void, T_arg...>
using iterator_type = signal_impl::const_iterator_type;
using call_type = typename slot_type::call_type;
- /** Executes a list of slots using an accumulator of type @e T_accumulator. * The arguments are passed
directly on to the slots.
+ /** Executes a list of slots using an accumulator of type @e T_accumulator. * The arguments are
+ * passed directly on to the slots.
* @param _A_a Arguments to be passed on to the slots.
*/
static decltype(auto) emit(signal_impl* impl, type_trait_take_t<T_arg>... _A_a)
- {
- if (!impl || impl->slots_.empty()) return;
- signal_exec exec(impl);
- temp_slot_list slots(impl->slots_);
+ {
+ if (!impl || impl->slots_.empty())
+ return;
+ signal_exec exec(impl);
+ temp_slot_list slots(impl->slots_);
- for (iterator_type it = slots.begin(); it != slots.end(); ++it)
- {
- if (it->empty() || it->blocked())
- continue;
- (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
- }
+ for (iterator_type it = slots.begin(); it != slots.end(); ++it)
+ {
+ if (it->empty() || it->blocked())
+ continue;
+ (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
}
+ }
- /** Executes a list of slots using an accumulator of type @e T_accumulator in reverse order. * The
arguments are passed directly on to the slots.
+ /** Executes a list of slots using an accumulator of type @e T_accumulator in reverse order. *
+ * The arguments are passed directly on to the slots.
* @param first An iterator pointing to the first slot in the list.
- * @param last An iterator pointing to the last slot in the list. * @param _A_a Arguments to be passed
on to the slots.
+ * @param last An iterator pointing to the last slot in the list. * @param _A_a Arguments to be
+ * passed on to the slots.
*/
static decltype(auto) emit_reverse(signal_impl* impl, type_trait_take_t<T_arg>... _A_a)
- {
- if (!impl || impl->slots_.empty()) return;
- signal_exec exec(impl);
- temp_slot_list slots(impl->slots_);
+ {
+ if (!impl || impl->slots_.empty())
+ return;
+ signal_exec exec(impl);
+ temp_slot_list slots(impl->slots_);
- using reverse_iterator_type = std::reverse_iterator<signal_impl::iterator_type>;
+ using reverse_iterator_type = std::reverse_iterator<signal_impl::iterator_type>;
- for (reverse_iterator_type it = reverse_iterator_type(slots.end()); it !=
reverse_iterator_type(slots.begin()); ++it)
- {
- if (it->empty() || it->blocked())
- continue;
- (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
- }
+ for (reverse_iterator_type it = reverse_iterator_type(slots.end());
+ it != reverse_iterator_type(slots.begin()); ++it)
+ {
+ if (it->empty() || it->blocked())
+ continue;
+ (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_, _A_a...);
}
+ }
};
-
-
} /* namespace internal */
-
/** Signal declaration.
* signal_with_accumulator can be used to connect() slots that are invoked
* during subsequent calls to emit(). Any functor or slot
@@ -840,7 +819,8 @@ struct signal_emit<void, void, T_arg...>
* iteration, insertion and removal of slots.
*
* The following template arguments are used:
- * - @e T_return The desired return type for the emit() function (may be overridden by the accumulator). * -
@e T_arg Argument types used in the definition of emit().
+ * - @e T_return The desired return type for the emit() function (may be overridden by the
+ * accumulator). * - @e T_arg Argument types used in the definition of emit().
* - @e T_accumulator The accumulator type used for emission. The default
* @p void means that no accumulator should be used, for example if signal
* emission returns the return value of the last slot invoked.
@@ -848,8 +828,7 @@ struct signal_emit<void, void, T_arg...>
* @ingroup signal
*/
template <class T_return, class T_accumulator, class... T_arg>
-class signal_with_accumulator
- : public signal_base
+class signal_with_accumulator : public signal_base
{
public:
using emitter_type = internal::signal_emit<T_return, T_accumulator, T_arg...>;
@@ -883,7 +862,9 @@ public:
* @return An iterator pointing to the new slot in the list.
*/
iterator connect(const slot_type& slot_)
- { return iterator(signal_base::connect(static_cast<const slot_base&>(slot_))); }
+ {
+ return iterator(signal_base::connect(static_cast<const slot_base&>(slot_)));
+ }
/** Add a slot to the list of slots.
* @see connect(const slot_type& slot_).
@@ -891,7 +872,9 @@ public:
* @newin{2,8}
*/
iterator connect(slot_type&& slot_)
- { return iterator(signal_base::connect(std::move(static_cast<slot_base&>(slot_)))); }
+ {
+ return iterator(signal_base::connect(std::move(static_cast<slot_base&>(slot_))));
+ }
/** Triggers the emission of the signal.
* During signal emission all slots that have been connected
@@ -904,15 +887,18 @@ public:
* @return The accumulated return values of the slot invocations.
*/
decltype(auto) emit(type_trait_take_t<T_arg>... _A_a) const
- { return emitter_type::emit(impl_, _A_a...); }
+ {
+ return emitter_type::emit(impl_, _A_a...);
+ }
/** Triggers the emission of the signal in reverse order (see emit()). */
decltype(auto) emit_reverse(type_trait_take_t<T_arg>... _A_a) const
- { return emitter_type::emit_reverse(impl_, _A_a...); }
+ {
+ return emitter_type::emit_reverse(impl_, _A_a...);
+ }
/** Triggers the emission of the signal (see emit()). */
- decltype(auto) operator()(type_trait_take_t<T_arg>... _A_a) const
- { return emit(_A_a...); }
+ decltype(auto) operator()(type_trait_take_t<T_arg>... _A_a) const { return emit(_A_a...); }
/** Creates a functor that calls emit() on this signal.
* @code
@@ -922,33 +908,32 @@ public:
* @return A functor that calls emit() on this signal.
*/
decltype(auto) make_slot() const
- {
- 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);
- }
+ {
+ 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);
+ }
/** Creates an STL-style interface for the signal's list of slots.
* This interface supports iteration, insertion and removal of slots.
* @return An STL-style interface for the signal's list of slots.
*/
- slot_list_type slots()
- { return slot_list_type(impl()); }
+ slot_list_type slots() { return slot_list_type(impl()); }
/** Creates an STL-style interface for the signal's list of slots.
* This interface supports iteration, insertion and removal of slots.
* @return An STL-style interface for the signal's list of slots.
*/
const slot_list_type slots() const
- { return slot_list_type(const_cast<signal_with_accumulator*>(this)->impl()); }
+ {
+ return slot_list_type(const_cast<signal_with_accumulator*>(this)->impl());
+ }
signal_with_accumulator() {}
- signal_with_accumulator(const signal_with_accumulator& src)
- : signal_base(src) {}
+ signal_with_accumulator(const signal_with_accumulator& src) : signal_base(src) {}
- signal_with_accumulator(signal_with_accumulator&& src)
- : signal_base(std::move(src)) {}
+ signal_with_accumulator(signal_with_accumulator&& src) : signal_base(std::move(src)) {}
signal_with_accumulator& operator=(const signal_with_accumulator& src)
{
@@ -963,7 +948,6 @@ public:
}
};
-
/** signal can be used to connect() slots that are invoked
* during subsequent calls to emit(). Any functor or slot
* can be passed into connect(). It is converted into a slot
@@ -983,7 +967,8 @@ public:
*
* The template arguments determine the function signature of
* the emit() function:
- * - @e T_return The desired return type of the emit() function. * - @e T_arg Argument types used in the
definition of emit().
+ * - @e T_return The desired return type of the emit() function. * - @e T_arg Argument types used in
+ * the definition of emit().
*
* For instance, to declare a signal whose connected slot returns void and takes
* two parameters of bool and int:
@@ -1007,8 +992,7 @@ template <class T_return, class... T_arg>
class signal;
template <class T_return, class... T_arg>
-class signal<T_return(T_arg...)>
- : public signal_with_accumulator<T_return, void, T_arg...>
+class signal<T_return(T_arg...)> : public signal_with_accumulator<T_return, void, T_arg...>
{
public:
using accumulator_type = void;
@@ -1060,22 +1044,24 @@ public:
* @ingroup signal
*/
template <class T_accumulator>
- class accumulated
- : public signal_with_accumulator<T_return, T_accumulator, T_arg...>
+ class accumulated : public signal_with_accumulator<T_return, T_accumulator, T_arg...>
{
public:
accumulated() {}
accumulated(const accumulated& src)
- : signal_with_accumulator<T_return, T_accumulator, T_arg...>(src) {}
+ : signal_with_accumulator<T_return, T_accumulator, T_arg...>(src)
+ {
+ }
};
signal() {}
- signal(const signal& src)
- : signal_with_accumulator<T_return, accumulator_type, T_arg...>(src) {}
+ signal(const signal& src) : signal_with_accumulator<T_return, accumulator_type, T_arg...>(src) {}
signal(signal&& src)
- : signal_with_accumulator<T_return, accumulator_type, T_arg...>(std::move(src)) {}
+ : signal_with_accumulator<T_return, accumulator_type, T_arg...>(std::move(src))
+ {
+ }
signal& operator=(const signal& src)
{
@@ -1090,8 +1076,6 @@ public:
}
};
-
-
} /* namespace sigc */
#endif /* _SIGC_SIGNAL_H_ */
diff --git a/sigc++/signal_base.h b/sigc++/signal_base.h
index bf79dd5..763828a 100644
--- a/sigc++/signal_base.h
+++ b/sigc++/signal_base.h
@@ -58,41 +58,47 @@ struct SIGC_API signal_impl : public notifiable
signal_impl(signal_impl&& src) = delete;
signal_impl& operator=(signal_impl&& src) = delete;
- // only MSVC needs this to guarantee that all new/delete are executed from the DLL module
+// only MSVC needs this to guarantee that all new/delete are executed from the DLL module
#ifdef SIGC_NEW_DELETE_IN_LIBRARY_ONLY
void* operator new(size_t size_);
void operator delete(void* p);
#endif
/// Increments the reference counter.
- inline void reference() noexcept
- { ++ref_count_; }
+ inline void reference() noexcept { ++ref_count_; }
/// Increments the reference and execution counter.
inline void reference_exec() noexcept
- { ++ref_count_; ++exec_count_; }
+ {
+ ++ref_count_;
+ ++exec_count_;
+ }
/** Decrements the reference counter.
* The object is deleted when the reference counter reaches zero.
*/
inline void unreference()
- { if (!(--ref_count_)) delete this; }
+ {
+ if (!(--ref_count_))
+ delete this;
+ }
/** Decrements the reference and execution counter.
* Invokes sweep() if the execution counter reaches zero and the
* removal of one or more slots has been deferred.
*/
inline void unreference_exec()
- {
- if (!(--ref_count_)) delete this;
- else if (!(--exec_count_) && deferred_) sweep();
- }
+ {
+ if (!(--ref_count_))
+ delete this;
+ else if (!(--exec_count_) && deferred_)
+ sweep();
+ }
/** Returns whether the list of slots is empty.
* @return @p true if the list of slots is empty.
*/
- inline bool empty() const noexcept
- { return slots_.empty(); }
+ inline bool empty() const noexcept { return slots_.empty(); }
/// Empties the list of slots.
void clear();
@@ -196,13 +202,13 @@ struct SIGC_API signal_exec
/** Increments the reference and execution counter of the parent sigc::signal_impl object.
* @param sig The parent sigc::signal_impl object.
*/
- inline signal_exec(const signal_impl* sig) noexcept
- : sig_(const_cast<signal_impl*>(sig) )
- { sig_->reference_exec(); }
+ inline signal_exec(const signal_impl* sig) noexcept : sig_(const_cast<signal_impl*>(sig))
+ {
+ sig_->reference_exec();
+ }
/// Decrements the reference and execution counter of the parent sigc::signal_impl object.
- inline ~signal_exec()
- { sig_->unreference_exec(); }
+ inline ~signal_exec() { sig_->unreference_exec(); }
};
/** Temporary slot list used during signal emission.
@@ -219,15 +225,12 @@ struct temp_slot_list
using iterator = signal_impl::iterator_type;
using const_iterator = signal_impl::const_iterator_type;
- temp_slot_list(slot_list &slots) : slots_(slots)
+ temp_slot_list(slot_list& slots) : slots_(slots)
{
placeholder = slots_.insert(slots_.end(), slot_base());
}
- ~temp_slot_list()
- {
- slots_.erase(placeholder);
- }
+ ~temp_slot_list() { slots_.erase(placeholder); }
iterator begin() { return slots_.begin(); }
iterator end() { return placeholder; }
@@ -235,15 +238,15 @@ struct temp_slot_list
const_iterator end() const { return placeholder; }
private:
- slot_list &slots_;
+ slot_list& slots_;
slot_list::iterator placeholder;
};
-
-} /* namespace internal */
+} /* namespace internal */
/** @defgroup signal Signals
- * Use sigc::signal::connect() with sigc::mem_fun() and sigc::ptr_fun() to connect a method or function with
a signal.
+ * Use sigc::signal::connect() with sigc::mem_fun() and sigc::ptr_fun() to connect a method or
+ * function with a signal.
*
* @code
* signal_clicked.connect( sigc::mem_fun(*this, &MyWindow::on_clicked) );
@@ -319,8 +322,7 @@ struct SIGC_API signal_base : public trackable
/** Returns whether the list of slots is empty.
* @return @p true if the list of slots is empty.
*/
- inline bool empty() const noexcept
- { return (!impl_ || impl_->empty()); }
+ inline bool empty() const noexcept { return (!impl_ || impl_->empty()); }
/// Empties the list of slots.
void clear();
@@ -411,6 +413,6 @@ protected:
mutable internal::signal_impl* impl_;
};
-} //namespace sigc
+} // namespace sigc
#endif /* _SIGC_SIGNAL_BASE_H_ */
diff --git a/sigc++/trackable.h b/sigc++/trackable.h
index 26ee492..c5490bb 100644
--- a/sigc++/trackable.h
+++ b/sigc++/trackable.h
@@ -21,14 +21,15 @@
#include <list>
#include <sigc++config.h>
-namespace sigc {
+namespace sigc
+{
struct notifiable;
-namespace internal {
-
-using func_destroy_notify = void (*) (notifiable* data);
+namespace internal
+{
+using func_destroy_notify = void (*)(notifiable* data);
/** Destroy notification callback.
* A destroy notification callback consists of a data pointer and a
@@ -40,8 +41,9 @@ struct SIGC_API trackable_callback
{
notifiable* data_;
func_destroy_notify func_;
- trackable_callback(notifiable* data, func_destroy_notify func) noexcept
- : data_(data), func_(func) {}
+ trackable_callback(notifiable* data, func_destroy_notify func) noexcept : data_(data), func_(func)
+ {
+ }
};
/** Callback list.
@@ -55,7 +57,7 @@ struct SIGC_API trackable_callback_list
/** Add a callback function.
* @param data Data that will be sent as a parameter to teh callback function.
* @param func The callback function.
- *
+ *
*/
void add_callback(notifiable* data, func_destroy_notify func);
@@ -68,8 +70,7 @@ struct SIGC_API trackable_callback_list
*/
void clear();
- trackable_callback_list()
- : clearing_(false) {}
+ trackable_callback_list() : clearing_(false) {}
trackable_callback_list(const trackable_callback_list& src) = delete;
trackable_callback_list& operator=(const trackable_callback_list& src) = delete;
@@ -83,18 +84,16 @@ struct SIGC_API trackable_callback_list
private:
using callback_list = std::list<trackable_callback>;
callback_list callbacks_;
- bool clearing_;
+ bool clearing_;
};
} /* namespace internal */
-
struct SIGC_API notifiable
{
using func_destroy_notify = internal::func_destroy_notify;
};
-
/** Base class for objects with auto-disconnection.
* trackable must be inherited when objects shall automatically
* invalidate slots referring to them on destruction.
@@ -134,12 +133,12 @@ struct SIGC_API trackable : public notifiable
~trackable();
- /*virtual ~trackable() {} */ /* we would need a virtual dtor for users
- who insist on using "trackable*" as
- pointer type for their own derived objects */
+ /*virtual ~trackable() {} */ /* we would need a virtual dtor for users
+ who insist on using "trackable*" as
+ pointer type for their own derived objects */
using func_destroy_notify = internal::func_destroy_notify;
-
+
/** Add a callback that is executed (notified) when the trackable object is detroyed.
* @param data Passed into func upon notification.
* @param func Callback executed upon destruction of the object.
diff --git a/sigc++/tuple-utils/tuple_cdr.h b/sigc++/tuple-utils/tuple_cdr.h
index 05d6bb2..e0c17f7 100644
--- a/sigc++/tuple-utils/tuple_cdr.h
+++ b/sigc++/tuple-utils/tuple_cdr.h
@@ -22,9 +22,11 @@
#include <type_traits>
#include <utility>
-namespace sigc {
+namespace sigc
+{
-namespace internal {
+namespace internal
+{
/**
* Get the type of a tuple without the first item.
@@ -39,11 +41,11 @@ 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)
+constexpr decltype(auto)
tuple_cdr_impl(T&& t, std::index_sequence<0, I...>)
{
using cdr = typename tuple_type_cdr<std::decay_t<T>>::type;
@@ -57,10 +59,10 @@ tuple_cdr_impl(T&& t, std::index_sequence<0, I...>)
* 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.
+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");
@@ -72,4 +74,4 @@ tuple_cdr(T&& t) {
} // namespace sigc
-#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 b31ad7c..6eeac12 100644
--- a/sigc++/tuple-utils/tuple_end.h
+++ b/sigc++/tuple-utils/tuple_end.h
@@ -20,44 +20,38 @@
#include <sigc++/tuple-utils/tuple_cdr.h>
-namespace sigc {
+namespace sigc
+{
-namespace internal {
+namespace internal
+{
-namespace detail {
+namespace detail
+{
template <typename T, std::size_t remove_from_start>
-struct tuple_end_impl {
- constexpr
- static
- decltype(auto) // typename tuple_type_end<T, size - remove_from_start>::type
- tuple_end(T&& t) {
+struct tuple_end_impl
+{
+ constexpr static decltype(auto) // typename tuple_type_end<T, size - remove_from_start>::type
+ tuple_end(T&& t)
+ {
static_assert(remove_from_start > 0, "remove_from_start must be more than zero.");
using cdr = typename tuple_type_cdr<std::decay_t<T>>::type;
- return tuple_end_impl<cdr, remove_from_start - 1>::tuple_end(
- tuple_cdr(std::forward<T>(t)));
+ return tuple_end_impl<cdr, remove_from_start - 1>::tuple_end(tuple_cdr(std::forward<T>(t)));
}
};
template <typename T>
-struct tuple_end_impl<T, 1> {
- constexpr
- static
- decltype(auto)
- tuple_end(T&& t) {
- return tuple_cdr(std::forward<T>(t));
- }
+struct tuple_end_impl<T, 1>
+{
+ constexpr static decltype(auto) tuple_end(T&& t) { return tuple_cdr(std::forward<T>(t)); }
};
template <typename T>
-struct tuple_end_impl<T, 0> {
- constexpr
- static
- decltype(auto)
- tuple_end(T&& t) {
- return std::forward<T>(t);
- }
+struct tuple_end_impl<T, 0>
+{
+ constexpr static decltype(auto) tuple_end(T&& t) { return std::forward<T>(t); }
};
} // detail namespace
@@ -66,10 +60,10 @@ struct tuple_end_impl<T, 0> {
* 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.
+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.");
constexpr auto size_start = size - len;
@@ -80,4 +74,4 @@ decltype(auto) // typename tuple_type_end<T, len>::type
} // namespace sigc
-#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 c66b45e..15e8a20 100644
--- a/sigc++/tuple-utils/tuple_for_each.h
+++ b/sigc++/tuple-utils/tuple_for_each.h
@@ -20,21 +20,22 @@
#include <tuple>
-namespace sigc {
+namespace sigc
+{
-namespace internal {
+namespace internal
+{
-namespace detail {
+namespace detail
+{
-template <template <typename> class T_visitor, std::size_t size_from_index,
- typename... T_extras>
-struct tuple_for_each_impl {
+template <template <typename> class T_visitor, std::size_t size_from_index, typename... T_extras>
+struct tuple_for_each_impl
+{
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.
+ constexpr static void tuple_for_each(T&& t, T_extras&&... extras)
+ {
+ // 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 > 1, "size must be more than 0.");
@@ -50,13 +51,12 @@ struct tuple_for_each_impl {
};
template <template <typename> class T_visitor, typename... T_extras>
-struct tuple_for_each_impl<T_visitor, 1, T_extras...> {
+struct tuple_for_each_impl<T_visitor, 1, T_extras...>
+{
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.
+ constexpr static void tuple_for_each(T&& t, T_extras&&... extras)
+ {
+ // 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, "size must be more than 0.");
@@ -64,24 +64,23 @@ struct tuple_for_each_impl<T_visitor, 1, T_extras...> {
static_assert(index >= 0, "unexpected index.");
using element_type = typename std::tuple_element<index, std::decay_t<T>>::type;
- T_visitor<element_type>::visit(std::get<index>(std::forward<T>(t)), std::forward<T_extras>(extras)...);
+ T_visitor<element_type>::visit(
+ std::get<index>(std::forward<T>(t)), std::forward<T_extras>(extras)...);
}
};
template <template <typename> class T_visitor, typename... T_extras>
-struct tuple_for_each_impl<T_visitor, 0, T_extras...> {
+struct tuple_for_each_impl<T_visitor, 0, T_extras...>
+{
template <typename T>
- constexpr
- static
- void
- tuple_for_each(T&& /* t */, T_extras&&... /* extras */) {
- //Do nothing because the tuple has no elements.
+ constexpr static void tuple_for_each(T&& /* t */, T_extras&&... /* extras */)
+ {
+ // Do nothing because the tuple has no elements.
}
};
} // detail namespace
-
/**
* Call the @e T_Visitor functors visit() method for each element,
* from the first to the last.
@@ -94,13 +93,14 @@ struct tuple_for_each_impl<T_visitor, 0, T_extras...> {
* @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>
-constexpr
-void
-tuple_for_each(T&& t, T_extras&&... extras) {
- //We use std::decay_t<> because tuple_size is not defined for references.
+constexpr void
+tuple_for_each(T&& t, T_extras&&... extras)
+{
+ // We use std::decay_t<> because tuple_size is not defined for references.
constexpr auto size = std::tuple_size<std::decay_t<T>>::value;
- if(size == 0) {
+ if (size == 0)
+ {
return;
}
@@ -112,4 +112,4 @@ tuple_for_each(T&& t, T_extras&&... extras) {
} // namespace sigc
-#endif //SIGC_TUPLE_UTILS_TUPLE_FOR_EACH_H
+#endif // SIGC_TUPLE_UTILS_TUPLE_FOR_EACH_H
diff --git a/sigc++/tuple-utils/tuple_start.h b/sigc++/tuple-utils/tuple_start.h
index 86b6066..06491ce 100644
--- a/sigc++/tuple-utils/tuple_start.h
+++ b/sigc++/tuple-utils/tuple_start.h
@@ -21,17 +21,21 @@
#include <tuple>
#include <utility>
-namespace sigc {
+namespace sigc
+{
-namespace internal {
+namespace internal
+{
-namespace detail {
+namespace detail
+{
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...>> {
+struct tuple_type_start_impl<T, std::index_sequence<I...>>
+{
using type = std::tuple<typename std::tuple_element<I, T>::type...>;
};
@@ -41,20 +45,21 @@ 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>> {};
+struct tuple_type_start : detail::tuple_type_start_impl<T, std::make_index_sequence<len>>
+{
+};
-namespace detail {
+namespace detail
+{
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) {
+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.");
@@ -70,10 +75,10 @@ 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.
+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.");
@@ -85,4 +90,4 @@ tuple_start(T&& t) {
} // namespace sigc
-#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 cff9bca..ff7b6a4 100644
--- a/sigc++/tuple-utils/tuple_transform_each.h
+++ b/sigc++/tuple-utils/tuple_transform_each.h
@@ -23,20 +23,23 @@
#include <sigc++/tuple-utils/tuple_start.h>
#include <type_traits>
-namespace sigc {
+namespace sigc
+{
-namespace internal {
+namespace internal
+{
-namespace detail {
+namespace detail
+{
template <template <typename> class T_transformer, std::size_t size_from_index>
-struct tuple_transform_each_impl {
+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) {
- //We use std::decay_t<> because tuple_size is not defined for references.
+ constexpr static decltype(auto) tuple_transform_each(T_current&& t, T_original& t_original)
+ {
+ // 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;
static_assert(size > 1, "size must be more than 0.");
@@ -46,8 +49,8 @@ struct tuple_transform_each_impl {
using from_element_type = typename std::tuple_element<index, std::decay_t<T_original>>::type;
using to_element_type = typename std::result_of<decltype (
&T_transformer<from_element_type>::transform)(from_element_type&)>::type;
- const auto t_element =
- std::tuple<to_element_type>(T_transformer<from_element_type>::transform(std::get<index>(t_original)));
+ const auto t_element = std::tuple<to_element_type>(
+ T_transformer<from_element_type>::transform(std::get<index>(t_original)));
const auto t_start = tuple_start<index>(std::forward<T_current>(t));
@@ -60,19 +63,18 @@ struct tuple_transform_each_impl {
const 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);
}
};
template <template <typename> class T_transformer>
-struct tuple_transform_each_impl<T_transformer, 1> {
+struct tuple_transform_each_impl<T_transformer, 1>
+{
template <typename T_current, typename T_original>
- constexpr
- static
- decltype(auto)
- tuple_transform_each(T_current&& t, T_original& t_original) {
- //We use std::decay_t<> because tuple_size is not defined for references.
+ constexpr static decltype(auto) tuple_transform_each(T_current&& t, T_original& t_original)
+ {
+ // 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;
static_assert(size > 0, "size must be more than 0.");
@@ -82,8 +84,8 @@ struct tuple_transform_each_impl<T_transformer, 1> {
using from_element_type = typename std::tuple_element<index, T_original>::type;
using to_element_type = typename std::result_of<decltype (
&T_transformer<from_element_type>::transform)(from_element_type&)>::type;
- const auto tuple_element =
- std::tuple<to_element_type>(T_transformer<from_element_type>::transform(std::get<index>(t_original)));
+ const auto tuple_element = std::tuple<to_element_type>(
+ T_transformer<from_element_type>::transform(std::get<index>(t_original)));
const auto tuple_rest = tuple_start<size - 1>(std::forward<T_current>(t));
return std::tuple_cat(tuple_rest, tuple_element);
@@ -91,14 +93,13 @@ struct tuple_transform_each_impl<T_transformer, 1> {
};
template <template <typename> class T_transformer>
-struct tuple_transform_each_impl<T_transformer, 0> {
+struct tuple_transform_each_impl<T_transformer, 0>
+{
template <typename T_current, typename T_original>
- constexpr
- static
- decltype(auto)
- tuple_transform_each(T_current&& t, T_original& /* t_original */) {
- //Do nothing because the tuple has no elements.
- return std::forward<T_current>(t);
+ constexpr static decltype(auto) tuple_transform_each(T_current&& t, T_original& /* t_original */)
+ {
+ // Do nothing because the tuple has no elements.
+ return std::forward<T_current>(t);
}
};
@@ -109,18 +110,18 @@ struct tuple_transform_each_impl<T_transformer, 0> {
* 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.
+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 internal
} // namespace sigc
-#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 fe67e3c..9eb1af9 100644
--- a/sigc++/type_traits.h
+++ b/sigc++/type_traits.h
@@ -21,8 +21,8 @@
#include <sigc++config.h>
-
-namespace sigc {
+namespace sigc
+{
template <class T_type>
struct type_trait
@@ -52,17 +52,17 @@ struct type_trait<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 487477a..3e3fdc0 100644
--- a/sigc++/visit_each.h
+++ b/sigc++/visit_each.h
@@ -21,33 +21,37 @@
#include <sigc++/type_traits.h>
#include <type_traits>
-namespace sigc {
+namespace sigc
+{
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-namespace internal {
+namespace internal
+{
-//This should really be an inner class of limit_derived_target, without the T_limit template type,
-//But the SUN CC 5.7 (not earlier versions) compiler finds it ambiguous when we specify a particular
specialization of it.
-//and does not seem to allow us to tell it explicitly that it's an inner class.
+// This should really be an inner class of limit_derived_target, without the T_limit template type,
+// But the SUN CC 5.7 (not earlier versions) compiler finds it ambiguous when we specify a
+// particular specialization of it.
+// and does not seem to allow us to tell it explicitly that it's an inner class.
template <bool I_derived, class T_type, class T_limit>
struct with_type;
-//Specialization for I_derived = false
-template <class T_type, class T_limit> struct
-with_type<false, T_type, T_limit>
+// Specialization for I_derived = false
+template <class T_type, class T_limit>
+struct with_type<false, T_type, T_limit>
{
static void execute_(const T_type&, const T_limit&) {}
};
-//Specialization for I_derived = true
+// Specialization for I_derived = true
template <class T_type, class T_limit>
struct with_type<true, T_type, T_limit>
{
static void execute_(const T_type& _A_type, const T_limit& _A_action)
- { _A_action.action_(_A_type); }
+ {
+ _A_action.action_(_A_type);
+ }
};
-
/// Helper struct for visit_each_type().
template <class T_target, class T_action>
struct limit_derived_target
@@ -57,34 +61,36 @@ struct limit_derived_target
template <class T_type>
void operator()(const T_type& _A_type) const
{
- with_type<std::is_base_of<T_target, T_type>::value || std::is_same<T_target, T_type>::value, T_type,
T_self>::execute_(_A_type, *this);
+ with_type<std::is_base_of<T_target, T_type>::value || std::is_same<T_target, T_type>::value,
+ T_type, T_self>::execute_(_A_type, *this);
}
- limit_derived_target(const T_action& _A_action)
- : action_(_A_action)
- {}
+ limit_derived_target(const T_action& _A_action) : action_(_A_action) {}
T_action action_;
};
-// Specialization for T_target pointer types, to provide a slightly different execute_() implementation.
+// Specialization for T_target pointer types, to provide a slightly different execute_()
+// implementation.
template <bool I_derived, class T_type, class T_limit>
struct with_type_pointer;
-//Specialization for I_derived = false
+// Specialization for I_derived = false
template <class T_type, class T_limit>
struct with_type_pointer<false, T_type, T_limit>
{
- static void execute_(const T_type&, const T_limit&) {}
+ static void execute_(const T_type&, const T_limit&) {}
};
-//Specialization for I_derived = true
+// Specialization for I_derived = true
template <class T_type, class T_limit>
struct with_type_pointer<true, T_type, T_limit>
{
static void execute_(const T_type& _A_type, const T_limit& _A_action)
- { _A_action.action_(&_A_type); }
+ {
+ _A_action.action_(&_A_type);
+ }
};
template <class T_target, class T_action>
@@ -95,12 +101,12 @@ struct limit_derived_target<T_target*, T_action>
template <class T_type>
void operator()(const T_type& _A_type) const
{
- with_type_pointer<std::is_base_of<T_target, T_type>::value || std::is_same<T_target, T_type>::value,
T_type, T_self>::execute_(_A_type, *this);
+ with_type_pointer<std::is_base_of<T_target, T_type>::value ||
+ std::is_same<T_target, T_type>::value,
+ T_type, T_self>::execute_(_A_type, *this);
}
- limit_derived_target(const T_action& _A_action)
- : action_(_A_action)
- {}
+ limit_derived_target(const T_action& _A_action) : action_(_A_action) {}
T_action action_;
};
@@ -115,7 +121,8 @@ struct limit_derived_target<T_target*, T_action>
// (argument-dependent lookup), and therefore there is no risk that a visit_each() overload
// in e.g. Boost is selected by mistake.
-/** sigc::visitor<T_functor>::do_visit_each() performs a functor on each of the targets of a functor.
+/** sigc::visitor<T_functor>::do_visit_each() performs a functor on each of the targets of a
+ * functor.
* All unknown types just call @a _A_action on them.
* Add specializations that specialize the @a T_functor argument for your own
* functor types, so that subobjects get visited. This is needed to enable
@@ -166,8 +173,11 @@ struct visitor
* @ingroup sigcfunctors
*/
template <class T_action, class T_functor>
-void visit_each(const T_action& _A_action, const T_functor& _A_functor)
-{ sigc::visitor<T_functor>::do_visit_each(_A_action, _A_functor); }
+void
+visit_each(const T_action& _A_action, const T_functor& _A_functor)
+{
+ sigc::visitor<T_functor>::do_visit_each(_A_action, _A_functor);
+}
/** This function performs a functor on each of the targets
* of a functor limited to a restricted type.
@@ -175,29 +185,32 @@ void visit_each(const T_action& _A_action, const T_functor& _A_functor)
* @ingroup sigcfunctors
*/
template <class T_type, class T_action, class T_functor>
-void visit_each_type(const T_action& _A_action, const T_functor& _A_functor)
+void
+visit_each_type(const T_action& _A_action, const T_functor& _A_functor)
{
using type_limited_action = internal::limit_derived_target<T_type, T_action>;
type_limited_action limited_action(_A_action);
- //specifying the types of the template specialization prevents disconnection of bound trackable references
(such as with std::ref()),
- //probably because the visit_each<> specializations take various different template types,
- //in various sequences, and we are probably specifying only a subset of them with this.
+ // specifying the types of the template specialization prevents disconnection of bound trackable
+ // references (such as with std::ref()),
+ // probably because the visit_each<> specializations take various different template types,
+ // in various sequences, and we are probably specifying only a subset of them with this.
//
- //But this is required by the AIX (and maybe IRIX MipsPro and Tru64) compilers.
- //I guess that std::ref() therefore does not work on those platforms. murrayc
+ // But this is required by the AIX (and maybe IRIX MipsPro and Tru64) compilers.
+ // I guess that std::ref() therefore does not work on those platforms. murrayc
// sigc::visit_each<type_limited_action, T_functor>(limited_action, _A_functor);
- //g++ (even slightly old ones) is our primary platform, so we could use the non-crashing version.
- //However, the explicit version also fixes a crash in a slightly more common case:
http://bugzilla.gnome.org/show_bug.cgi?id=169225
- //Users (and distributors) of libsigc++ on AIX (and maybe IRIX MipsPro and Tru64) do
- //need to use the version above instead, to allow compilation.
+ // g++ (even slightly old ones) is our primary platform, so we could use the non-crashing version.
+ // However, the explicit version also fixes a crash in a slightly more common case:
+ // http://bugzilla.gnome.org/show_bug.cgi?id=169225
+ // Users (and distributors) of libsigc++ on AIX (and maybe IRIX MipsPro and Tru64) do
+ // need to use the version above instead, to allow compilation.
- //Added 2014-03-20: The preceding comment probably does not apply any more,
- //now when the visit_each<>() overloads have been replaced by visitor<> specializations.
- //It's probably safe to add explicit template parameters on calls to visit_each(),
- //visit_each_type() and visitor::do_visit_each(), if necessary.
+ // Added 2014-03-20: The preceding comment probably does not apply any more,
+ // now when the visit_each<>() overloads have been replaced by visitor<> specializations.
+ // It's probably safe to add explicit template parameters on calls to visit_each(),
+ // visit_each_type() and visitor::do_visit_each(), if necessary.
sigc::visit_each(limited_action, _A_functor);
}
diff --git a/tests/testutilities.h b/tests/testutilities.h
index f06d6d9..772689d 100644
--- a/tests/testutilities.h
+++ b/tests/testutilities.h
@@ -24,7 +24,6 @@
class TestUtilities
{
public:
-
// Non-copyable:
TestUtilities(const TestUtilities&) = delete;
TestUtilities& operator=(const TestUtilities&) = delete;
@@ -44,8 +43,6 @@ public:
static bool get_result_and_delete_instance();
private:
-
-
TestUtilities();
static TestUtilities* instance_;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]