August 2005
Intermediate to advanced
432 pages
9h 41m
English
• Automatic lifetime management of objects with shared_ptr makes shared ownership of resources effective and safe.
• Safe observation of shared resources through weak_ptr avoids dangling pointers.
• Scoped resources using scoped_ptr and scoped_array make the code easier to write and maintain, and helps in writing exception-safe code.
Smart pointers solve the problem of managing the lifetime of resources (typically dynamically allocated objects1). Smart pointers come in different flavors. Most share one key feature—automatic resource management. This feature is manifested in different ways, such as lifetime control over dynamically allocated objects, and acquisition and ...
Read now
Unlock full access