Imported Upstream version 2.99.2
[platform/upstream/libsigc++.git] / sigc++ / adaptors / bind.h
index ba6b2ad..459b884 100644 (file)
@@ -38,7 +38,7 @@ namespace sigc {
  *
  * @par Example:
  * @code
- * sigc::signal<void> some_signal;
+ * sigc::signal<void()> some_signal;
  * void foo(int);
  * some_signal.connect(sigc::bind(&foo,1));
  * @endcode
@@ -58,7 +58,7 @@ namespace sigc {
  * @par Example:
  * @code
  * int some_int;
- * sigc::signal<void> some_signal;
+ * sigc::signal<void()> some_signal;
  * void foo(int&);
  * some_signal.connect(sigc::bind(&foo, std::ref(some_int)));
  * @endcode
@@ -70,7 +70,7 @@ namespace sigc {
  * @par Example:
  * @code
  * struct bar : public sigc::trackable {} some_bar;
- * sigc::signal<void> some_signal;
+ * sigc::signal<void()> some_signal;
  * void foo(bar&);
  * some_signal.connect(sigc::bind(&foo, std::ref(some_bar)));
  *   // disconnected automatically if some_bar goes out of scope
@@ -87,6 +87,7 @@ 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) {
@@ -125,19 +126,19 @@ struct bind_functor : public adapts<T_functor>
       //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>...>;
-      auto t_args = std::tuple<T_arg...>(std::forward<T_arg>(_A_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.");
 
-      auto t_start = internal::tuple_start<I_location>(t_args);
-      auto t_bound = internal::tuple_transform_each<internal::TransformEachInvoker>(bound_);
-      auto t_end = internal::tuple_end<t_args_size - I_location>(t_args);
-      auto t_with_bound = std::tuple_cat(t_start, t_bound, t_end);
+      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);
 
-      const auto seq = std::make_index_sequence<std::tuple_size<decltype(t_with_bound)>::value>();
+      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);
     }
 
@@ -186,11 +187,11 @@ struct bind_functor<-1, T_functor, T_type...> : public adapts<T_functor>
       //For instance, if _A_arg has 4 arguments,
       //we would want to call operator() with (_A_arg0, _A_arg1, _A_arg2, bound).
       
-      auto t_args = std::tuple<T_arg...>(std::forward<T_arg>(_A_arg)...);
-      auto t_bound = internal::tuple_transform_each<internal::TransformEachInvoker>(bound_);
-      auto t_with_bound = std::tuple_cat(t_args, t_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);
 
-      const auto seq = std::make_index_sequence<std::tuple_size<decltype(t_with_bound)>::value>();
+      constexpr auto seq = std::make_index_sequence<std::tuple_size<decltype(t_with_bound)>::value>();
       return call_functor_operator_parentheses(t_with_bound, seq);
     }
 
@@ -223,6 +224,7 @@ template<typename T_element>
 struct TupleVisitorVisitEach
 {
   template<typename T_action>
+  constexpr
   static
   void
   visit(const T_element& element, const T_action& action)