
25 Apr
2008
25 Apr
'08
2:24 a.m.
Hi Richard, That was foolish of me to think that bla will point to fooInstance. Obviously it will point to a copy of Foo instance. Thanks for that note. However, you also mentioned that the two options are different: (1) shared_ptr<Foo> bla(new Foo(fooInstance)); (2) shared_ptr<Foo> bla; bla = shared_ptr<Foo>(new Foo(fooInstance)); You mentioned that the second will create a temporary that will "go away". Can you elaborate on that. It seems to me that it shouldn't go away, as long as bla is within scope. I guess that was my main question originally, whether the second option is a correct way to set bla (when, say, it's a class member). Many thanks! Lex