|
Boost Users : |
From: Lex Fridman (lexfridman_at_[hidden])
Date: 2008-04-24 22:24:42
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
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