|
26 | 26 | // See https://bugzilla.gnome.org/show_bug.cgi?id=672555
|
27 | 27 | // - Test the code example in the documentation in sigc++/adaptors/track_obj.h.
|
28 | 28 | //
|
29 |
| -// To test the C++11 lambda expressions with gcc 4.6.3 (and probably some later |
30 |
| -// versions of gcc; gcc 4.7.x also understands -std=c++11): |
31 |
| -// make CXXFLAGS='-g -O2 -std=c++0x' test_track_obj |
32 |
| -// ./test_track_obj |
33 |
| -// echo $? |
34 | 29 | // If test_track_obj writes nothing and the return code is 0, the test has passed.
|
35 | 30 |
|
36 | 31 | #include "testutilities.h"
|
@@ -191,18 +186,16 @@ main(int argc, char* argv[])
|
191 | 186 | sl20();
|
192 | 187 | util->check_result(result_stream, "");
|
193 | 188 |
|
194 |
| - // Code example in the documentation sigc++/adaptors/macros/track_obj.h.m4 |
195 |
| - // ----------------------------------------------------------------------- |
| 189 | + // Code example in the documentation sigc++/adaptors/track_obj.h. |
| 190 | + // -------------------------------------------------------------- |
196 | 191 | {
|
197 | 192 | // struct bar : public sigc::trackable {} some_bar;
|
198 | 193 | sigc::signal<void()> some_signal;
|
199 | 194 | {
|
200 | 195 | bar_group4 some_bar;
|
201 |
| - // some_signal.connect(sigc::group(&foo, std::ref(some_bar))); |
202 |
| - // disconnected automatically if some_bar goes out of scope |
203 | 196 | // some_signal.connect([&some_bar](){ foo_group4(some_bar); }); // no auto-disconnect
|
204 |
| - // some_signal.connect(sigc::bind(&foo_group4, std::ref(some_bar))); // auto-disconnects, but |
205 |
| - // we prefer C++11 lambda |
| 197 | + // some_signal.connect(sigc::bind(&foo_group4, std::ref(some_bar))); // auto-disconnects, |
| 198 | + // but we prefer C++11 lambda |
206 | 199 | some_signal.connect(sigc::track_obj([&some_bar]() { foo_group4(some_bar); }, some_bar));
|
207 | 200 | some_signal.emit();
|
208 | 201 | util->check_result(result_stream, "foo_group4(bar_group4&)");
|
|
0 commit comments