Skip to content

Commit 051d1ca

Browse files
committed
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
1 parent f0dd3d4 commit 051d1ca

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sigc++/adaptors/bind.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ struct bind_functor : public adapts<T_functor>
161161
{
162162
}
163163

164-
private:
164+
// public to avoid template friend declarations (used by visitor::do_visit_each())
165165
/// The arguments bound to the functor.
166166
std::tuple<bound_argument<T_bound>...> bound_;
167167
};
@@ -202,6 +202,7 @@ struct bind_functor<-1, T_functor, T_type...> : public adapts<T_functor>
202202
{
203203
}
204204

205+
// public to avoid template friend declarations (used by visitor::do_visit_each())
205206
/// The argument bound to the functor.
206207
std::tuple<bound_argument<T_type>...> bound_;
207208
};

tests/test_bind.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,19 @@ main(int argc, char* argv[])
146146

147147
sigc::slot<void()> sl;
148148
{
149+
// Test without a positional template argument to std::bind().
149150
book guest_book("karl");
150151
sl = sigc::bind(&egon, std::ref(guest_book));
151152
sl();
152153
result_stream << " " << static_cast<std::string&>(guest_book);
153154
util->check_result(result_stream, "egon(string 'karl') egon was here");
155+
156+
// Test with a positional template argument to std::bind<>().
157+
guest_book.get_name() = "ove";
158+
sl = sigc::bind<0>(&egon, std::ref(guest_book));
159+
sl();
160+
result_stream << " " << static_cast<std::string&>(guest_book);
161+
util->check_result(result_stream, "egon(string 'ove') egon was here");
154162
} // auto-disconnect
155163

156164
sl();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy