[libsigcplusplus/libsigc++-2-8] tests: Prefer the non-deprecated mem_fun(reference, func) form.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus/libsigc++-2-8] tests: Prefer the non-deprecated mem_fun(reference, func) form.
- Date: Thu, 10 Mar 2016 18:50:46 +0000 (UTC)
commit 5ff7fed96a83bf3e6436834bfd56d4f75d9e6290
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Mar 10 19:43:07 2016 +0100
tests: Prefer the non-deprecated mem_fun(reference, func) form.
tests/test_accumulated.cc | 4 ++--
tests/test_bind_refptr.cc | 4 ++--
tests/test_disconnect.cc | 14 +++++++-------
tests/test_limit_reference.cc | 2 +-
tests/test_signal.cc | 4 ++--
tests/test_trackable.cc | 2 +-
tests/test_trackable_move.cc | 4 ++--
tests/test_visit_each.cc | 6 +++---
8 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/tests/test_accumulated.cc b/tests/test_accumulated.cc
index adbc295..6fad26c 100644
--- a/tests/test_accumulated.cc
+++ b/tests/test_accumulated.cc
@@ -89,11 +89,11 @@ int main(int argc, char* argv[])
A a;
sig.connect(sigc::ptr_fun1(&foo));
- sig.connect(sigc::mem_fun1(&a, &A::foo));
+ sig.connect(sigc::mem_fun1(a, &A::foo));
sig.connect(sigc::ptr_fun1(&bar));
sig_vec.connect(sigc::ptr_fun1(&foo));
- sig_vec.connect(sigc::mem_fun1(&a, &A::foo));
+ sig_vec.connect(sigc::mem_fun1(a, &A::foo));
sig_vec.connect(sigc::ptr_fun1(&bar));
double dres = sig(1);
diff --git a/tests/test_bind_refptr.cc b/tests/test_bind_refptr.cc
index f8fe446..a8909af 100644
--- a/tests/test_bind_refptr.cc
+++ b/tests/test_bind_refptr.cc
@@ -441,10 +441,10 @@ public:
{
result_stream << "new Test; ";
#ifdef ACTIVATE_BUG //See https://bugzilla.gnome.org/show_bug.cgi?id=564005#c14
- action->signal_sig1().connect(sigc::bind(sigc::mem_fun(this, &Test::on_sig1), action));
+ action->signal_sig1().connect(sigc::bind(sigc::mem_fun(*this, &Test::on_sig1), action));
#else
Glib::RefPtr<Action> action2(new Action);
- action->signal_sig1().connect(sigc::bind(sigc::mem_fun(this, &Test::on_sig1), action2));
+ action->signal_sig1().connect(sigc::bind(sigc::mem_fun(*this, &Test::on_sig1), action2));
#endif
}
diff --git a/tests/test_disconnect.cc b/tests/test_disconnect.cc
index 048acbd..85b1680 100644
--- a/tests/test_disconnect.cc
+++ b/tests/test_disconnect.cc
@@ -50,8 +50,8 @@ struct B : public sigc::trackable
{
B()
{
- sig.connect(sigc::mem_fun(this, &B::destroy));
- sig.connect(sigc::mem_fun(this, &B::boom));
+ sig.connect(sigc::mem_fun(*this, &B::destroy));
+ sig.connect(sigc::mem_fun(*this, &B::boom));
sig.connect(sigc::ptr_fun(&good_bye_world));
}
@@ -89,7 +89,7 @@ int main(int argc, char* argv[])
{
A a;
- sig.connect(sigc::mem_fun1(&a, &A::foo));
+ sig.connect(sigc::mem_fun1(a, &A::foo));
confoo = sig.connect(sigc::ptr_fun1(&foo));
conbar = sig.connect(sigc::ptr_fun1(&bar));
result_stream << "sig is connected to A::foo, foo, bar (size=" << sig.size() << "): ";
@@ -103,7 +103,7 @@ int main(int argc, char* argv[])
util->check_result(result_stream, "sig is connected to foo, bar (size=2): foo(2) bar(2) ");
A a; // iterators stay valid after further connections.
- cona = sig.slots().insert(conbar, sigc::mem_fun1(&a, &A::foo));
+ cona = sig.slots().insert(conbar, sigc::mem_fun1(a, &A::foo));
result_stream << "sig is connected to foo, A::foo, bar (size=" << sig.size() << "): ";
sig(3);
util->check_result(result_stream,
@@ -128,7 +128,7 @@ int main(int argc, char* argv[])
{
A a2;
- sig.connect(sigc::compose(sigc::mem_fun(&a2, &A::foo), &foo));
+ sig.connect(sigc::compose(sigc::mem_fun(a2, &A::foo), &foo));
result_stream << "sig is connected to compose(A::foo, foo) (size=" << sig.size() << "): ";
sig(7);
util->check_result(result_stream, "sig is connected to compose(A::foo, foo) (size=1): foo(7) A::foo(1)
");
@@ -139,7 +139,7 @@ int main(int argc, char* argv[])
{ // A slot# within a slot
A a2;
- sigc::slot1<int, int> setter = sigc::mem_fun(&a2, &A::foo);
+ sigc::slot1<int, int> setter = sigc::mem_fun(a2, &A::foo);
sig.connect(sigc::compose(setter, &foo));
result_stream << "sig is connected to compose(slot1(A::foo), foo) (size=" << sig.size() << "): ";
sig(9);
@@ -151,7 +151,7 @@ int main(int argc, char* argv[])
{ // A slot within a slot
A a2;
- sigc::slot<int, int> setter = sigc::mem_fun(&a2, &A::foo);
+ sigc::slot<int, int> setter = sigc::mem_fun(a2, &A::foo);
sig.connect(sigc::compose(setter, &foo));
result_stream << "sig is connected to compose(slot(A::foo), foo) (size=" << sig.size() << "): ";
sig(11);
diff --git a/tests/test_limit_reference.cc b/tests/test_limit_reference.cc
index d8f3539..3f56ded 100644
--- a/tests/test_limit_reference.cc
+++ b/tests/test_limit_reference.cc
@@ -40,7 +40,7 @@ int main(int argc, char* argv[])
return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE;
auto instance = new Derived();
- sigc::slot<void> handler = sigc::mem_fun(instance, &Derived::method);
+ sigc::slot<void> handler = sigc::mem_fun(*instance, &Derived::method);
handler();
util->check_result(result_stream, "method()");
diff --git a/tests/test_signal.cc b/tests/test_signal.cc
index 163eb11..9c6134e 100644
--- a/tests/test_signal.cc
+++ b/tests/test_signal.cc
@@ -62,7 +62,7 @@ int main(int argc, char* argv[])
{
A a;
sig.connect(sigc::ptr_fun1(&foo));
- sig.connect(sigc::mem_fun1(&a, &A::foo));
+ sig.connect(sigc::mem_fun1(a, &A::foo));
sig.connect(sigc::ptr_fun1(&bar));
sig(1);
result_stream << sig.size();
@@ -78,7 +78,7 @@ int main(int argc, char* argv[])
A a;
std::string str("guest book");
sigc::signal<void,std::string&> sigstr;
- sigstr.connect(sigc::mem_fun(&a, &A::bar));
+ sigstr.connect(sigc::mem_fun(a, &A::bar));
sigstr(str);
result_stream << str;
util->check_result(result_stream, "A::foo(string 'guest book') foo was here");
diff --git a/tests/test_trackable.cc b/tests/test_trackable.cc
index 159aeeb..4630260 100644
--- a/tests/test_trackable.cc
+++ b/tests/test_trackable.cc
@@ -38,7 +38,7 @@ int main(int argc, char* argv[])
{
my_class t;
t.i = 10;
- sl = sigc::mem_fun0(&t, &my_class::foo);
+ sl = sigc::mem_fun0(t, &my_class::foo);
sl();
util->check_result(result_stream, "10");
}
diff --git a/tests/test_trackable_move.cc b/tests/test_trackable_move.cc
index 2d16273..c4a25e2 100644
--- a/tests/test_trackable_move.cc
+++ b/tests/test_trackable_move.cc
@@ -61,7 +61,7 @@ int main(int argc, char* argv[])
{
my_class t;
t.i = 10;
- sl = sigc::mem_fun0(&t, &my_class::foo);
+ sl = sigc::mem_fun0(t, &my_class::foo);
sl();
util->check_result(result_stream, "10");
@@ -70,7 +70,7 @@ int main(int argc, char* argv[])
t2.i = 15;
result_stream.clear();
- sl = sigc::mem_fun0(&t2, &my_class::foo);
+ sl = sigc::mem_fun0(t2, &my_class::foo);
sl();
util->check_result(result_stream, "15");
diff --git a/tests/test_visit_each.cc b/tests/test_visit_each.cc
index a63fa43..a4a9cb9 100644
--- a/tests/test_visit_each.cc
+++ b/tests/test_visit_each.cc
@@ -167,7 +167,7 @@ int main(int argc, char* argv[])
{
MyClass1 my_class1("x=");
- sl1 = sigc::mem_fun(&my_class1, &MyClass1::execute);
+ sl1 = sigc::mem_fun(my_class1, &MyClass1::execute);
sl1(-2);
util->check_result(result_stream, "x=-2");
@@ -179,7 +179,7 @@ int main(int argc, char* argv[])
#if SIGCTEST_CASE >= 2
{
MyClass2 my_class2("y=");
- sl1 = sigc::mem_fun(&my_class2, &MyClass2::execute);
+ sl1 = sigc::mem_fun(my_class2, &MyClass2::execute);
sl1(2);
util->check_result(result_stream, "y=2");
@@ -191,7 +191,7 @@ int main(int argc, char* argv[])
{
MyClass1 my_class3("a=");
- sl1 = ns1::my_adaptor1(sigc::mem_fun(&my_class3, &MyClass1::execute));
+ sl1 = ns1::my_adaptor1(sigc::mem_fun(my_class3, &MyClass1::execute));
sl1(42);
util->check_result(result_stream, "MyAdaptor1()(_A_arg1) a=42");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]