|
Boost Users : |
Subject: Re: [Boost-users] [signals2, bind] connecting a slot with unrelated signature
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-08-06 15:16:43
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 06 August 2009, Igor R wrote:
> It turns out that the simple nested binds with protect() solve this.
Why do you need nested binds? Doesn't this work?:
#include <boost/signals2/signal.hpp>
#include <iostream>
using namespace boost;
void callback(int cookie)
{
std::cout << cookie << std::endl;
}
int main()
{
signals2::signal<void(int, double, int)> sig;
// I'd like to bind cookie=5 and to connect such a binder to the signal.
sig.connect(bind(&callback, 5));
sig(1, 2.2, 3);
return 0;
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkp7LBwACgkQ5vihyNWuA4UWVgCfcn2/dm5odcy7NvR80IDx1dps
U3IAnj+DTRbr6W4jLi+lqY+6GwyqraRO
=4rtH
-----END PGP SIGNATURE-----
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net