auto_ptr is still worth learning

auto_ptr was about the only smart pointer in the standard library (Until boost shared_ptr was added to TR1) and has been used in commercial apps for years. Obviously, it’s not designed for STL. Well, competent programmers won’t use auto_ptr in STL, so it’s basically robust and battle tested.

People say auto_ptr can lead to bugs in the hands of a novice, but what c++ features can’t?

The essential features of auto_ptr are very much relevant even if you use an alternative smart ptr. Numerous wall street interviews still reference auto_ptr.

In MTS, I simply replaced every “auto_ptr” in source code with “unique_ptr”, because auto_ptr has been deprecated in c++11.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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