Boost logo

Boost :

Subject: [boost] what is the interest of In Place factory
From: rodrigue pons (pons.rodrigue_at_[hidden])
Date: 2009-10-29 10:35:52


Hello,

I was looking about the boost In Place Factory to resolve a problem i
got, and there is something i don't understand: what is the advantage
of this lib?

For example:

I get a class A, wich constructor is:
A( int, const string& );

And an another class, C, that contains an A*. C provides a method to
construct this A*:
void C::BuildA( int i, const string & str );

wich will be called this way:
instance_of_C.BuildA( 1, "test" );

If now i use the boost In Place Factory, the member function C::BuildA
will become:

template<class InPlaceFactoryT>
void C::BuildA( InPlaceFactoryT const& factory )

wich will be called this way:
instance_of_C.BuildA( 1, "test" );

We can see here that with or wothout the In Place Factory, the code is
exactly the same. So i guess there is something i didn't understand.
But what?


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