Boost logo

Boost Users :

Subject: Re: [Boost-users] [Statechart] Passing reference to create_processor()
From: Juraj Ivančić (juraj.ivancic_at_[hidden])
Date: 2009-04-10 06:15:18


Hawkes Steve-FSH016 wrote:
> It appears that the create_processor implementation instantiates code
> that
> attempts to copy the argument.

It does, and this is why you must pass boost::ref wrapper instead
of the reference itself.

> processor1 =
> scheduler.create_processor
> <Test, Object&>
> (boost::ref(value));

Here you instruct the compiler to convert the parameter into Object &,
and therefore boost::ref has no effect, as the conversion takes place
"before" the create_processor call. Just omit the "Object &" template
parameter and let the compiler deduce it and the code should compile.

HTH
Juraj Ivančić


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