[signals] call a slot only once

Hello,
Is there a way to automatically have a slot disconnected after it has been
called once, without managing the connection manually?
void f()
{
}
signal

Nevermind,
I'll just keep a vector<connection> in a signal-derived class, and
disconnects these after every invocation of the signal. Maybe not the most
clever way, but it works.
If there is an efficient way of doing this, I'll be happy to now about it
though.
Thanks,
Christian
On 02/10/2007, Christian Holmquist
Hello,
Is there a way to automatically have a slot disconnected after it has been called once, without managing the connection manually?
void f() { }
signal
sig; sig.connect(&f); sig(); // f gets called sig(); // f shouldn't get called

How?
Could you provide me with some example code? I read the documentation on
connection management and didn't find anything pointing me in the right
direction.
Christian
On 02/10/2007, Frank Mori Hess
On Tuesday 02 October 2007 05:49 am, Christian Holmquist wrote:
Hello,
Is there a way to automatically have a slot disconnected after it has been called once, without managing the connection manually?
You can have the slot disconnect itself.
-- Frank
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 02 October 2007 14:20 pm, Christian Holmquist wrote:
How?
Could you provide me with some example code? I read the documentation on connection management and didn't find anything pointing me in the right direction.
I just meant that you can call connection::disconnect() at the end of your slot function, as long as you somehow give it access to its connection object. - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHApIn5vihyNWuA4URAtw9AJ9tRw6yDcZN4xf2NvZechEmhK0iQACcC0Z1 PABoxISv96lB9NM3x9STcSA= =a0AK -----END PGP SIGNATURE-----
participants (2)
-
Christian Holmquist
-
Frank Mori Hess