Boost logo

Boost Users :

From: Lex Fridman (lexfridman_at_[hidden])
Date: 2008-04-24 17:34:35


Hi,

Say I have a class definition:
class Foo() {...};

And an instance of that class:
Foo fooInstance;

I would like to create a shared_ptr pointing to this instance of Foo.
Most documentation recommends the following way to do it:
shared_ptr<Foo> bla(new Foo(fooInstance));

But can I also do this:
shared_ptr<Foo> bla;
bla = shared_ptr<Foo>(new Foo(fooInstance));

Are there any problems with the second (or the first) method?

Thanks,
Lex


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