
24 Apr
2008
24 Apr
'08
9:34 p.m.
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