auto_ptr vs scoped_ptr, in essence

(See also post on auto_ptr vs shared_ptr.)

Boost scoped_ptr ++forbids++ copy and assignment[2] whereas aptr permits these 2 accidents to happen.

scptr gives up ownership carefully, via reset, where as aptr does so accidentally and freely.

A const auto_ptr (i am not saying “auto_ptr to const”) is very similar to a scoped_ptr. There’s a small difference — P 13 [[boost]]

[2] Note some text explicitly says a scoped_ptr can’t be the LHS of assignment due to compilation error.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s