-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scoped_connection: new wrapper to auto-disconnect… #97
scoped_connection: new wrapper to auto-disconnect… #97
Conversation
e61a2fa
to
dce79ed
Compare
Updated to be One thing I'm not 100% sure about is the |
dce79ed
to
a664a27
Compare
New files shall also be added to
Add In the code snippet showing shared ownership, shouldn't it be
In the description of the move constructor, remove "The current slot, if any...".
In the .cc file, s/return conn_.block();/return conn_.block(should_block);/ You seem to assume that sigc::connection is movable. It is not. It's copyable How is swap() supposed to work? It's declared as a friend in .h, defined in .cc, I tried to add a call to swap() in test_scoped_connection.cc. Results:
|
Thanks for the other spots, will address later.
I don't assume that. I saw that it is only copyable right now. But if it were to be movable in future, we could have newer code ready to take advantage of that. But if you want me to drop the moves, let me know.
I really should have tested that. I'll add a test and get it working right.
I believe this is the usually recommended 'swap two-step', where we ensure that we'll use |
…a contained sigc::connection, when the scoped_connection is destructed. libsigcplusplus#87
a664a27
to
b878ab7
Compare
|
Your explanation makes sense.
I reacted to pass-by-value in the constructor and assignment taking a connection. There are a few minor fixes to do. I'll fix them myself after I've merged your PR. Probably the clang-format CI test will react to your code. If it does react |
Thanks for the merge and cleanups! Do you think there's anywhere else we could/should add mentions of |
You can see the latest documentation at https://libsigcplusplus.github.io/libsigcplusplus/ If you really want to document more, you can mention scoped_connection at |
Add a TODO that once we depend on sigc++ 3.6 or later, that will now have a scoped_connection doing the same thing, which I authored. :-) Once upstream has that we should stop rolling our own variant of it. libsigcplusplus/libsigcplusplus#97
…a contained sigc::connection, when the scoped_connection is destructed.
#87