Boost logo

Boost Users :

Subject: Re: [Boost-users] Example program that fails to compile (boost::bind and boost::function called for collection)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-27 21:21:32


AMDG

Archie14 wrote:
> typedef boost::function<void (int, int, const char*) > delegateOne;
> typedef boost::function<void (int, const char*) > delegateTwo;
>
> class A : public boost::noncopyable
> {
> public:
> void commandhandler(delegateOne& f) {
> // I want to replace first argument in "delegateOne" with value 100.
> delegateTwo two = boost::bind(&f, 100, _2, _3);
> }
> };
>

I assume that you want to store a reference to f in two?

use boost::ref(f) instead of &f.

In Christ,
Steven Watanabe


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