summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2019-10-27 12:09:22 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2019-10-27 12:09:22 +0100
commit051d1cab888a55d3565024041f32ba046f0fb3e3 (patch)
tree5baa767042d2bcce177ff8f7169856011017da24
parentf0dd3d4523ac87dc2858e585e4f7d3f4603cd97d (diff)
downloadsigc++-051d1cab888a55d3565024041f32ba046f0fb3e3.tar.gz
sigc++/adaptors/bind.h: Make bind_functor::bound_ public
It's used by sigc::visitor::do_visit_each(). Add a test case in tests/test_bind.cc. Fixes #26
-rw-r--r--sigc++/adaptors/bind.h3
-rw-r--r--tests/test_bind.cc8
2 files changed, 10 insertions, 1 deletions
diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h
index 7088c9f..7c187d1 100644
--- a/sigc++/adaptors/bind.h
+++ b/sigc++/adaptors/bind.h
@@ -161,7 +161,7 @@ struct bind_functor : public adapts<T_functor>
{
}
-private:
+ // public to avoid template friend declarations (used by visitor::do_visit_each())
/// The arguments bound to the functor.
std::tuple<bound_argument<T_bound>...> bound_;
};
@@ -202,6 +202,7 @@ public:
{
}
+ // public to avoid template friend declarations (used by visitor::do_visit_each())
/// The argument bound to the functor.
std::tuple<bound_argument<T_type>...> bound_;
};
diff --git a/tests/test_bind.cc b/tests/test_bind.cc
index 7d4a354..80dc9ea 100644
--- a/tests/test_bind.cc
+++ b/tests/test_bind.cc
@@ -146,11 +146,19 @@ main(int argc, char* argv[])
sigc::slot<void()> sl;
{
+ // Test without a positional template argument to std::bind().
book guest_book("karl");
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");
+
+ // Test with a positional template argument to std::bind<>().
+ guest_book.get_name() = "ove";
+ sl = sigc::bind<0>(&egon, std::ref(guest_book));
+ sl();
+ result_stream << " " << static_cast<std::string&>(guest_book);
+ util->check_result(result_stream, "egon(string 'ove') egon was here");
} // auto-disconnect
sl();