Boost logo

Boost Users :

From: Jiri Palecek (jpalecek_at_[hidden])
Date: 2006-06-26 09:26:45


On Mon, 26 Jun 2006 13:52:24 +0200, Lars Monecke <lars_at_[hidden]> wrote:

> Hi,
>
> i'm stucked and google does not lead me to the right pages :-(
>
> The follwing code example does not compile on gcc 4.1.1 an boost 1.33.1
> . It
> works on msvc.net 7.1.
>
> ---code starts here
> #include <boost/bind.hpp>
> #include <boost/signal.hpp>
>
> #include <iostream>
>
> struct Printer
> {
> void operator()(int iValue) {
> std::cout << iValue << "\n";
> }
> };
>
> int main(int /* argc */, char* /* argv[] */)
> {
>
> typedef boost::signal<void (int)> tSignal;
>
> tSignal stSignal;
>
> Printer stPrinter;
> stSignal.connect(stPrinter);
> typedef std::vector<int> tConInts;
>
> tConInts cInts;
>
> cInts.push_back(1);
> cInts.push_back(2);
> cInts.push_back(3);
>
> for_each(cInts.begin(),
> cInts.end(),
> boost::bind(&tSignal::operator(),
> boost::ref(stSignal),
> _1));
>
> return 0;
> }
> ---code ends here

> Any hints?
Doesn't something like
   for_each(...,...,bind(stSignal,_1));

work?

(Maybe with bind<Ret>(), see docs)

Regards
     Jiri Palecek

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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