Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-12 10:22:09


eric wrote:
> hello
>
> given the following class hierarchy
>
> class Foo {
> protected:
> virtual ~Foo() {}
> };
>
> class Bar : public Foo {};
>
> and declaration
>
> boost::shared_ptr<Foo> foo;
>
> is there any difference between the two assignment statements below?
>
> foo = boost::shared_ptr<Foo>(new Bar);
> foo = boost::shared_ptr<Bar>(new Bar);

No, the first form is a shorthand for the second form, and so is

    foo.reset( new Bar );


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