"Peter Dimov" <[EMAIL PROTECTED]> wrote in message
003f01c2a06f$2c4f6550$1d00a8c0@pdimov2">news:003f01c2a06f$2c4f6550$1d00a8c0@pdimov2...
> From: "Eric Woodruff" <[EMAIL PROTECTED]>
> > Using g++ 2.95.4,
> >
> > #include <iostream>
> > #include <boost/shared_ptr>
>
> Changed to <boost/shared_ptr.hpp>.
>

Mistyped in the message, but was correct in the code.

> > struct Object {
> >    ~Object () {
> >        std::cout << "byebye" << std::endl;
> >     }
> > };
> >
> > int main () {
> >     Object o; // destructs
> >     boost::shared_ptr<void> (new Object); // does not destruct, however
> > apprears to delete
> >      std::cout << "done." << std::endl;
> > }
>
> C:\Documents and Settings\pdimov\My
Documents\Projects\testbed>g++ --version
> 2.95.3-6
>
> C:\Documents and Settings\pdimov\My Documents\Projects\testbed>g++
> testbed.cpp
>
> C:\Documents and Settings\pdimov\My Documents\Projects\testbed>a
> byebye
> done.
> byebye
>
> Note that you are constructing an unnamed temporary shared_ptr<void>,
which
> is why it destructs before "done." is printed.

Doesn't make any difference with the outcome in theory or in my test as I
just tried it.

int main () {
boost::shared_ptr<void> p (new Object);
}

No destructor printed.




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to