16 Jul
2008
16 Jul
'08
7:53 p.m.
On Wed, Jul 16, 2008 at 12:13 PM, Igor R
I don't need to do 'b= NULL' in A's constructor, right?
Right.
But why this line won't compile "b = new B();" ?
The constructor you need for this conversion is declared as "explicit". Do it this way:
typedef boost::shared_ptr<B> BPtr; B& A::getB() { if (!b) b = BPtr(new B()); return *b; // btw, do you really wish to return the reference? }
Thank you. You said 'btw, do you really wish to return the reference?' , Can you please tell me what do you mean, like what kind of problems it will cause?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users