Search results
Results from the WOW.Com Content Network
The auto_ptr has semantics of strict ownership, meaning that the auto_ptr instance is the sole entity responsible for the object's lifetime. If an auto_ptr is copied, the source loses the reference. For example:
The copy constructor and assignment operators of auto_ptr do not actually copy the stored pointer. Instead, they transfer it , leaving the prior auto_ptr object empty. This was one way to implement strict ownership, so that only one auto_ptr object can own the pointer at any given time.
For this purpose, the C++11 standard library defines the smart pointer classes std::unique_ptr for single-owned objects and std::shared_ptr for objects with shared ownership. Similar classes are also available through std::auto_ptr in C++98, and boost::shared_ptr in the Boost libraries. Also, messages can be sent to network resources using RAII.
Since C++11, the C++ standard library also provides smart pointers (unique_ptr, shared_ptr and weak_ptr) which can be used in some situations as a safer alternative to primitive C pointers. C++ also supports another form of reference, quite different from a pointer, called simply a reference or reference type .
std::auto_ptr is deprecated, having been superseded by std::unique_ptr. Function object base classes (std::unary_function, std::binary_function), adapters to pointers to functions and adapters to pointers to members, and binder classes are all deprecated.
Main page; Contents; Current events; Random article; About Wikipedia; Contact us; Donate
1. Henry Repeating Arms. Going by the motto "Made in America, or Not Made at All," gun enthusiasts can rest assured that Henry Repeating Arms is deeply rooted in local tradition.
A function pointer, also called a subroutine pointer or procedure pointer, is a pointer referencing executable code, rather than data. Dereferencing the function pointer yields the referenced function, which can be invoked and passed arguments just as in a normal function call.