[libsigcplusplus/variadic_mem_fun3: 27/148] C++11: Replace sigc::ref() with std::ref().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus/variadic_mem_fun3: 27/148] C++11: Replace sigc::ref() with std::ref().
- Date: Mon, 7 Mar 2016 10:00:03 +0000 (UTC)
commit e7fb7d1f67cefc95a128b81243a1a39d9d20b02d
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Jan 8 10:06:39 2016 +0100
C++11: Replace sigc::ref() with std::ref().
It seems to be remarkably similar.
sigc++/adaptors/bound_argument.h | 15 ++++----
sigc++/adaptors/macros/bind.h.m4 | 6 ++--
sigc++/reference_wrapper.h | 66 ++-----------------------------------
sigc++/visit_each.h | 4 +-
tests/test_bind.cc | 7 ++--
tests/test_bind_ref.cc | 7 ++--
tests/test_bind_return.cc | 7 ++--
tests/test_copy_invalid_slot.cc | 3 +-
tests/test_cpp11_lambda.cc | 29 ++++++++--------
tests/test_functor_trait.cc | 7 ++--
tests/test_limit_reference.cc | 5 ++-
tests/test_track_obj.cc | 4 +-
12 files changed, 53 insertions(+), 107 deletions(-)
---
diff --git a/sigc++/adaptors/bound_argument.h b/sigc++/adaptors/bound_argument.h
index 0579682..ee9b6aa 100644
--- a/sigc++/adaptors/bound_argument.h
+++ b/sigc++/adaptors/bound_argument.h
@@ -23,18 +23,17 @@
#include <sigc++/limit_reference.h>
#include <sigc++/reference_wrapper.h>
-
namespace sigc {
/** 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 (reference_wrapper<Bar>) then this
+ * 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
* invoked, the limit_reference::invoke() method provides the argument (a Bar&).
* When the slot is visited (e.g. visit_each<>()), we simply visit the limit_reference,
* which will visit the derived type, or a sigc::trackable base if necessary.
*
- * Likewise, If Foo is a wrapped const reference to a class Bar (const_reference_wrapper<Bar>)
+ * Likewise, If Foo is a wrapped const reference to a class Bar (std::reference_wrapper<const Bar>)
* then this object is implemented on top of a const_limit_reference.
*
* If Foo is something else (such as an argument that is bound by value) bound_argument just
@@ -77,17 +76,17 @@ private:
//Template specialization:
/** bound_argument object for a bound argument that is passed by bind() or
- * returned by bind_return() by reference, specialized for reference_wrapper<> types.
+ * 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< reference_wrapper<T_wrapped> >
+class bound_argument< std::reference_wrapper<T_wrapped> >
{
public:
/** Constructor.
* @param _A_argument The argument to bind.
*/
- bound_argument(const reference_wrapper<T_wrapped>& _A_argument)
+ bound_argument(const std::reference_wrapper<T_wrapped>& _A_argument)
: visited_(unwrap(_A_argument))
{}
@@ -114,13 +113,13 @@ private:
* - @e T_wrapped The type of the bound argument.
*/
template <class T_wrapped>
-class bound_argument< const_reference_wrapper<T_wrapped> >
+class bound_argument< std::reference_wrapper<const T_wrapped> >
{
public:
/** Constructor.
* @param _A_argument The argument to bind.
*/
- bound_argument(const const_reference_wrapper<T_wrapped>& _A_argument)
+ bound_argument(const std::reference_wrapper<const T_wrapped>& _A_argument)
: visited_(unwrap(_A_argument))
{}
diff --git a/sigc++/adaptors/macros/bind.h.m4 b/sigc++/adaptors/macros/bind.h.m4
index c008f46..367a3c0 100644
--- a/sigc++/adaptors/macros/bind.h.m4
+++ b/sigc++/adaptors/macros/bind.h.m4
@@ -320,14 +320,14 @@ struct count_void<void,void,void,void,void,void,void>
* @endcode
*
* You can bind references to functors by passing the objects through
- * the sigc::ref() helper function.
+ * the std::ref() helper function.
*
* @par Example:
* @code
* int some_int;
* sigc::signal<void> some_signal;
* void foo(int&);
- * some_signal.connect(sigc::bind(&foo,sigc::ref(some_int)));
+ * some_signal.connect(sigc::bind(&foo, std::ref(some_int)));
* @endcode
*
* If you bind an object of a sigc::trackable derived type to a functor
@@ -339,7 +339,7 @@ struct count_void<void,void,void,void,void,void,void>
* struct bar : public sigc::trackable {} some_bar;
* sigc::signal<void> some_signal;
* void foo(bar&);
- * some_signal.connect(sigc::bind(&foo,sigc::ref(some_bar)));
+ * some_signal.connect(sigc::bind(&foo, std::ref(some_bar)));
* // disconnected automatically if some_bar goes out of scope
* @endcode
*
diff --git a/sigc++/reference_wrapper.h b/sigc++/reference_wrapper.h
index 5a57e91..99b072f 100644
--- a/sigc++/reference_wrapper.h
+++ b/sigc++/reference_wrapper.h
@@ -21,64 +21,6 @@
namespace sigc {
-/** Reference wrapper.
- * Use sigc::ref() to create a reference wrapper.
- */
-template <class T_type>
-struct reference_wrapper
-{
- explicit reference_wrapper(T_type& v)
- : value_(v) {}
-
- operator T_type& () const
- { return value_; }
-
- T_type& value_;
-};
-
-/** Const reference wrapper.
- * Use sigc::ref() to create a const reference wrapper.
- */
-template <class T_type>
-struct const_reference_wrapper
-{
- explicit const_reference_wrapper(const T_type& v)
- : value_(v) {}
-
- operator const T_type& () const
- { return value_; }
-
- const T_type& value_;
-};
-
-/** Creates a reference wrapper.
- * Passing an object throught sigc::ref() makes libsigc++ adaptors
- * like, e.g., sigc::bind store references to the object instead of copies.
- * If the object type inherits from sigc::trackable this will ensure
- * automatic invalidation of the adaptors when the object is deleted
- * or overwritten.
- *
- * @param v Reference to store.
- * @return A reference wrapper.
- */
-template <class T_type>
-reference_wrapper<T_type> ref(T_type& v)
-{ return reference_wrapper<T_type>(v); }
-
-/** Creates a const reference wrapper.
- * Passing an object throught sigc::ref() makes libsigc++ adaptors
- * like, e.g., sigc::bind store references to the object instead of copies.
- * If the object type inherits from sigc::trackable this will ensure
- * automatic invalidation of the adaptors when the object is deleted
- * or overwritten.
- *
- * @param v Reference to store.
- * @return A reference wrapper.
- */
-template <class T_type>
-const_reference_wrapper<T_type> ref(const T_type& v)
-{ return const_reference_wrapper<T_type>(v); }
-
template <class T_type>
struct unwrap_reference
{
@@ -86,23 +28,23 @@ struct unwrap_reference
};
template <class T_type>
-struct unwrap_reference<reference_wrapper<T_type> >
+struct unwrap_reference<std::reference_wrapper<T_type> >
{
typedef T_type& type;
};
template <class T_type>
-struct unwrap_reference<const_reference_wrapper<T_type> >
+struct unwrap_reference<std::reference_wrapper<const T_type> >
{
typedef const T_type& type;
};
template <class T_type>
-T_type& unwrap(const reference_wrapper<T_type>& v)
+T_type& unwrap(const std::reference_wrapper<T_type>& v)
{ return v; }
template <class T_type>
-const T_type& unwrap(const const_reference_wrapper<T_type>& v)
+const T_type& unwrap(const std::reference_wrapper<const T_type>& v)
{ return v; }
} /* namespace sigc */
diff --git a/sigc++/visit_each.h b/sigc++/visit_each.h
index 82f4236..ab681cb 100644
--- a/sigc++/visit_each.h
+++ b/sigc++/visit_each.h
@@ -181,12 +181,12 @@ void visit_each_type(const T_action& _A_action, const T_functor& _A_functor)
type_limited_action limited_action(_A_action);
- //specifying the types of the template specialization prevents disconnection of bound trackable references
(such as with sigc::ref()),
+ //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 sigc::ref() therefore does not work on those platforms. murrayc
+ //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.
diff --git a/tests/test_bind.cc b/tests/test_bind.cc
index 845d54c..3ab7cf6 100644
--- a/tests/test_bind.cc
+++ b/tests/test_bind.cc
@@ -8,6 +8,7 @@
#include <sigc++/functors/slot.h>
#include <sstream>
#include <string>
+#include <functional> //For std::ref().
#include <cstdlib>
namespace
@@ -130,7 +131,7 @@ int main(int argc, char* argv[])
// method pointer instead of functor
book test_book("otto");
- result_stream << sigc::bind<0>(&book::get_name, sigc::ref(test_book))();
+ result_stream << sigc::bind<0>(&book::get_name, std::ref(test_book))();
util->check_result(result_stream, "otto");
// test return type of bind_functor::operator() overload with no arguments
@@ -142,14 +143,14 @@ int main(int argc, char* argv[])
// test references
std::string str("guest book");
- sigc::bind(&egon, sigc::ref(str))(); // Tell bind that it shall store a reference.
+ sigc::bind(&egon, std::ref(str))(); // Tell bind that it shall store a reference.
result_stream << " " << str; // (This cannot be the default behaviour: just think about what happens if
str dies!)
util->check_result(result_stream, "egon(string 'guest book') egon was here");
sigc::slot<void> sl;
{
book guest_book("karl");
- sl = sigc::bind(&egon, sigc::ref(guest_book));
+ sl = sigc::bind(&egon, std::ref(guest_book));
sl();
result_stream << " " << static_cast<std::string&>(guest_book);
util->check_result(result_stream, "egon(string 'karl') egon was here");
diff --git a/tests/test_bind_ref.cc b/tests/test_bind_ref.cc
index 58bd55d..d8ea53b 100644
--- a/tests/test_bind_ref.cc
+++ b/tests/test_bind_ref.cc
@@ -2,6 +2,7 @@
#include <sigc++/sigc++.h>
#include <sstream>
#include <string>
+#include <functional> //For std::ref().
#include <cstdlib>
namespace
@@ -48,12 +49,12 @@ int main(int argc, char* argv[])
util->check_result(result_stream, "");
{
- //Because Param derives from sigc::trackable(), sigc::ref() should disconnect
+ //Because Param derives from sigc::trackable(), std::ref() should disconnect
// the signal handler when param is destroyed.
Param param("murrayc");
// A convoluted way to do
- // slot_bound = sigc::bind(slot_full, sigc::ref(param));
- slot_bound = sigc::bind< -1, sigc::reference_wrapper<Param> >(slot_full, sigc::ref(param));
+ // slot_bound = sigc::bind(slot_full, std::ref(param));
+ slot_bound = sigc::bind< -1, std::reference_wrapper<Param> >(slot_full, std::ref(param));
result_stream << "Calling slot when param exists:";
slot_bound();
diff --git a/tests/test_bind_return.cc b/tests/test_bind_return.cc
index 88c85ae..232f402 100644
--- a/tests/test_bind_return.cc
+++ b/tests/test_bind_return.cc
@@ -8,6 +8,7 @@
#include <sigc++/functors/slot.h>
#include <sstream>
#include <string>
+#include <functional> //For std::ref().
#include <cstdlib>
namespace
@@ -52,8 +53,8 @@ int main(int argc, char* argv[])
// references.
std::string str("guest book");
// A convoluted way to do
- // sigc::bind_return(foo(), sigc::ref(str))(6) = "main";
- sigc::bind_return<sigc::reference_wrapper<std::string> >(foo(), sigc::ref(str))(6) = "main";
+ // sigc::bind_return(foo(), std::ref(str))(6) = "main";
+ sigc::bind_return<std::reference_wrapper<std::string> >(foo(), std::ref(str))(6) = "main";
result_stream << str;
util->check_result(result_stream, "foo(int 6) main");
@@ -67,7 +68,7 @@ int main(int argc, char* argv[])
sigc::slot<bar, int> sl;
{
bar choco(-1);
- sl = sigc::bind_return(foo(),sigc::ref(choco));
+ sl = sigc::bind_return(foo(), std::ref(choco));
result_stream << sl(7);
util->check_result(result_stream, "foo(int 7) -1");
} // auto-disconnect
diff --git a/tests/test_copy_invalid_slot.cc b/tests/test_copy_invalid_slot.cc
index b480a15..a6179c3 100644
--- a/tests/test_copy_invalid_slot.cc
+++ b/tests/test_copy_invalid_slot.cc
@@ -4,6 +4,7 @@
#include <sigc++/sigc++.h>
#include <stdlib.h>
#include <string.h>
+#include <functional> //For std::ref().
namespace
{
@@ -30,7 +31,7 @@ int main(int argc, char* argv[])
util->check_result(result_stream, "sigc::trackable instance at " + pointer_stream.str());
pointer_stream.str("");
- sigc::slot<void> foo = sigc::bind(sigc::ptr_fun(Foo), sigc::ref(*t));
+ sigc::slot<void> foo = sigc::bind(sigc::ptr_fun(Foo), std::ref(*t));
foo();
util->check_result(result_stream, "Foo(x)");
diff --git a/tests/test_cpp11_lambda.cc b/tests/test_cpp11_lambda.cc
index e97b80e..5532f26 100644
--- a/tests/test_cpp11_lambda.cc
+++ b/tests/test_cpp11_lambda.cc
@@ -51,7 +51,6 @@
#include <cstdlib>
#include <sigc++/functors/functors.h>
#include <sigc++/bind.h>
-#include <sigc++/reference_wrapper.h>
#include <sigc++/adaptors/track_obj.h>
#include <sigc++/signal.h>
@@ -182,9 +181,9 @@ int main(int argc, char* argv[])
result_stream << ([] (int x) -> int { return ++x * 2; }(a_outer)) << " " << a_outer;
util->check_result(result_stream, "4 1");
- // gcc can't compile libsigc++ lambda expressions with sigc::ref() parameters.
+ // gcc can't compile libsigc++ lambda expressions with std::ref() parameters.
// See https://bugzilla.gnome.org/show_bug.cgi?id=669128
- // std::cout << "((++_1)*2)(ref(a)): " << ((++_1)*2)(sigc::ref(a));
+ // std::cout << "((++_1)*2)(ref(a)): " << ((++_1)*2)(std::ref(a));
// std::cout << "; a: " << a << std::endl;
result_stream << ([] (std::reference_wrapper<int> x) -> int { return ++x * 2; }(std::ref(a_outer)));
result_stream << " " << a_outer;
@@ -199,7 +198,7 @@ int main(int argc, char* argv[])
result_stream << " " << a_outer;
util->check_result(result_stream, "8 4");
- // std::cout << "((--(*(&_1)))*2)(ref(a)): " << ((--(*(&_1)))*2)(sigc::ref(a));
+ // std::cout << "((--(*(&_1)))*2)(ref(a)): " << ((--(*(&_1)))*2)(std::ref(a));
// std::cout << "; a: " << a << std::endl;
result_stream << ([] (std::reference_wrapper<int> x) -> int { return --(*(&x)) * 2; }(std::ref(a_outer)));
result_stream << " " << a_outer;
@@ -241,15 +240,15 @@ int main(int argc, char* argv[])
// - var() is used to create a lambda that holds a reference and is interchangable with ref() in lambda
operator expressions
// - cannot use std::endl without much hackery because it is defined as a template function
// - cannot use "\n" without var() because arrays cannot be copied
- // (sigc::ref(std::cout) << sigc::constant(1) << sigc::var("\n"))();
+ // (std::ref(std::cout) << sigc::constant(1) << sigc::var("\n"))();
[](){ result_stream << 1 << "\n"; }();
util->check_result(result_stream, "1\n");
- //(sigc::ref(std::cout) << _1 << std::string("\n"))("hello world");
+ //(std::ref(std::cout) << _1 << std::string("\n"))("hello world");
[](const char* a){ result_stream << a << std::string("\n"); }("hello world");
util->check_result(result_stream, "hello world\n");
- //(sigc::ref(std::cout) << sigc::static_cast_<int>(_1) << std::string("\n"))(1.234);
+ //(std::ref(std::cout) << sigc::static_cast_<int>(_1) << std::string("\n"))(1.234);
[](double a){ result_stream << static_cast<int>(a) << std::string("\n"); }(1.234);
util->check_result(result_stream, "1\n");
@@ -269,7 +268,7 @@ int main(int argc, char* argv[])
sigc::slot<void, std::ostringstream&> sl1;
{
book guest_book("karl");
- //sl1 = (sigc::var(std::cout) << sigc::ref(guest_book) << sigc::var("\n"));
+ //sl1 = (sigc::var(std::cout) << std::ref(guest_book) << sigc::var("\n"));
// sl1 = [&guest_book](std::ostringstream& stream){ stream << guest_book << "\n"; }; // no
auto-disconnect
sl1 = sigc::track_obj([&guest_book](std::ostringstream& stream){ stream << guest_book << "\n"; },
guest_book);
sl1(result_stream);
@@ -290,7 +289,7 @@ int main(int argc, char* argv[])
result_stream << std::bind(&foo, std::placeholders::_2, std::placeholders::_1)(1, 2);
util->check_result(result_stream, "foo(int 2, int 1) 9");
- //std::cout << (sigc::group(sigc::mem_fun(&bar::test), _1, _2, _3)) (sigc::ref(the_bar), 1, 2) <<
std::endl;
+ //std::cout << (sigc::group(sigc::mem_fun(&bar::test), _1, _2, _3)) (std::ref(the_bar), 1, 2) << std::endl;
// std::ref(the_bar) is not necessary. It can make the call ambiguous.
// Even without std::ref() the_bar is not copied.
result_stream << std::bind(std::mem_fn(&bar::test), std::placeholders::_1,
@@ -320,7 +319,7 @@ int main(int argc, char* argv[])
sigc::slot<void> sl2;
{
book guest_book("karl");
- //sl2 = sigc::group(&egon, sigc::ref(guest_book));
+ //sl2 = sigc::group(&egon, std::ref(guest_book));
// sl2 = [&guest_book] () { egon(guest_book); }; // no auto-disconnect
// sl2 = std::bind(&egon, std::ref(guest_book)); // does not compile (gcc 4.6.3)
sl2 = sigc::track_obj([&guest_book] () { egon(guest_book); }, guest_book);
@@ -339,7 +338,7 @@ int main(int argc, char* argv[])
// More auto-disconnect
{
book guest_book("charlie");
- //sl2 = sigc::group(&egon, sigc::ref(guest_book));
+ //sl2 = sigc::group(&egon, std::ref(guest_book));
// sl2 = std::bind(&egon, std::ref(guest_book)); // does not compile (gcc 4.6.3)
auto fn2 = std::bind(&egon, std::ref(guest_book));
//sl2 = fn2; // no auto-disconnect
@@ -469,9 +468,9 @@ int main(int argc, char* argv[])
{
int some_int = 0;
sigc::signal<void> some_signal;
- //some_signal.connect(sigc::group(&foo,sigc::ref(some_int)));
+ //some_signal.connect(sigc::group(&foo,std::ref(some_int)));
//some_signal.connect(std::bind(&foo_group3, std::ref(some_int))); // does not compile (gcc 4.6.3)
- //some_signal.connect(sigc::bind(&foo_group3, sigc::ref(some_int))); // compiles, but we prefer
std::bind() or C++11 lambda
+ //some_signal.connect(sigc::bind(&foo_group3, std::ref(some_int))); // compiles, but we prefer
std::bind() or C++11 lambda
some_signal.connect([&some_int](){ foo_group3(some_int); });
some_signal.emit();
result_stream << " " << some_int;
@@ -483,10 +482,10 @@ int main(int argc, char* argv[])
sigc::signal<void> some_signal;
{
bar_group4 some_bar;
- //some_signal.connect(sigc::group(&foo,sigc::ref(some_bar)));
+ //some_signal.connect(sigc::group(&foo, std::ref(some_bar)));
// disconnected automatically if some_bar goes out of scope
//some_signal.connect([&some_bar](){ foo_group4(some_bar); }); // no auto-disconnect
- //some_signal.connect(sigc::bind(&foo_group4, sigc::ref(some_bar))); // auto-disconnects, but we
prefer C++11 lambda
+ //some_signal.connect(sigc::bind(&foo_group4, std::ref(some_bar))); // auto-disconnects, but we prefer
C++11 lambda
some_signal.connect(sigc::track_obj([&some_bar](){ foo_group4(some_bar); }, some_bar));
some_signal.emit();
util->check_result(result_stream, "foo_group4(bar_group4&)");
diff --git a/tests/test_functor_trait.cc b/tests/test_functor_trait.cc
index 1031845..c14a126 100644
--- a/tests/test_functor_trait.cc
+++ b/tests/test_functor_trait.cc
@@ -4,6 +4,7 @@
#include "testutilities.h"
#include <sstream>
+#include <functional> //For std::ref().
#include <cstdlib>
#include <sigc++/adaptors/bind.h>
#include <sigc++/adaptors/compose.h>
@@ -83,15 +84,15 @@ int main(int argc, char* argv[])
int k = 3;
A a;
result_stream << "hit all targets: ";
- sigc::visit_each(print(), sigc::compose(sigc::bind(sigc::ptr_fun(&foo), sigc::ref(a), i),
sigc::ptr_fun(&bar)));
+ sigc::visit_each(print(), sigc::compose(sigc::bind(sigc::ptr_fun(&foo), std::ref(a), i),
sigc::ptr_fun(&bar)));
util->check_result(result_stream, "hit all targets: other trackable int: 1 other ");
result_stream << "hit all ints: ";
- sigc::visit_each_type<int>(print(), sigc::compose(sigc::bind(sigc::ptr_fun(&foo), sigc::ref(a),
j),sigc::ptr_fun(&bar)));
+ sigc::visit_each_type<int>(print(), sigc::compose(sigc::bind(sigc::ptr_fun(&foo), std::ref(a),
j),sigc::ptr_fun(&bar)));
util->check_result(result_stream, "hit all ints: int: 2 ");
result_stream << "hit all trackable: ";
- sigc::visit_each_type<trackable>(print(), sigc::compose(sigc::bind(sigc::ptr_fun(&foo), sigc::ref(a),
k),sigc::ptr_fun(&bar)));
+ sigc::visit_each_type<trackable>(print(), sigc::compose(sigc::bind(sigc::ptr_fun(&foo), std::ref(a),
k),sigc::ptr_fun(&bar)));
util->check_result(result_stream, "hit all trackable: trackable ");
return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/test_limit_reference.cc b/tests/test_limit_reference.cc
index d72efd1..34fa547 100644
--- a/tests/test_limit_reference.cc
+++ b/tests/test_limit_reference.cc
@@ -1,6 +1,7 @@
#include "testutilities.h"
#include <sigc++/sigc++.h>
#include <sstream>
+#include <functional> //For std::ref().
#include <cstdlib>
namespace
@@ -45,12 +46,12 @@ int main(int argc, char* argv[])
util->check_result(result_stream, "method()");
auto param =
- sigc::bind(sigc::slot<void, Derived&>(), sigc::ref(*instance));
+ sigc::bind(sigc::slot<void, Derived&>(), std::ref(*instance));
param();
util->check_result(result_stream, "");
auto ret =
- sigc::bind_return(sigc::slot<void>(), sigc::ref(*instance));
+ sigc::bind_return(sigc::slot<void>(), std::ref(*instance));
ret();
util->check_result(result_stream, "");
diff --git a/tests/test_track_obj.cc b/tests/test_track_obj.cc
index a6ce6ed..635be0c 100644
--- a/tests/test_track_obj.cc
+++ b/tests/test_track_obj.cc
@@ -202,10 +202,10 @@ int main(int argc, char* argv[])
sigc::signal<void> some_signal;
{
bar_group4 some_bar;
- //some_signal.connect(sigc::group(&foo,sigc::ref(some_bar)));
+ //some_signal.connect(sigc::group(&foo, std::ref(some_bar)));
// disconnected automatically if some_bar goes out of scope
//some_signal.connect([&some_bar](){ foo_group4(some_bar); }); // no auto-disconnect
- //some_signal.connect(sigc::bind(&foo_group4, sigc::ref(some_bar))); // auto-disconnects, but we
prefer C++11 lambda
+ //some_signal.connect(sigc::bind(&foo_group4, std::ref(some_bar))); // auto-disconnects, but we prefer
C++11 lambda
some_signal.connect(sigc::track_obj([&some_bar](){ foo_group4(some_bar); }, some_bar));
some_signal.emit();
util->check_result(result_stream, "foo_group4(bar_group4&)");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]