Boost logo

Boost :

From: Marco Costalba (mcostalba_at_[hidden])
Date: 2007-09-01 12:36:48


On 9/1/07, Mathias Gaunard <mathias.gaunard_at_[hidden]> wrote:
> Marco Costalba wrote:
>
> > You can view as HTML page a simple and commented test program here:
> > http://digilander.libero.it/mcostalba/simple_factory/main.cpp.html
>
> Your small document doesn't talk about ownership and lifetime management
> of the created object.
>

The factory returns a plain old pointer to the created object. That's
it. You can
improve as you want, but I'm more interested in checking the soundness
of the design at this stage...there will be time also for smart
pointers ;-) but now it's still in "design" time.

> As for the forwarding problem, this is solved using rvalue references.
> However, since they're not available in C++03, people use pass-by-value
> instead, and boost::ref when they want to pass by reference.
>

Well, parameters are indeed passed by copy, per default, and by
reference only after fully qualifying Factory::object() template
parameters.

I understand the presentation document it's not very "high quality",
it is more "show by examples" stuff. Please refer directly to
simple_factory.hpp (it's small enough) to see the details.

Thanks
Marco


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk