| Technical Specification | ||||
| Filesystem library(filesystem TS) | ||||
| Library fundamentals(library fundamentals TS) | ||||
| Library fundamentals 2(library fundamentals TS v2) | ||||
| Library fundamentals 3(library fundamentals TS v3) | ||||
| Extensions for parallelism(parallelism TS) | ||||
| Extensions for parallelism 2(parallelism TS v2) | ||||
| Extensions for concurrency(concurrency TS) | ||||
| Extensions for concurrency 2(concurrency TS v2) | ||||
| Concepts(concepts TS) | ||||
| Ranges(ranges TS) | ||||
| Reflection(reflection TS) | ||||
| Mathematical special functions(special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
experimental::observer_ptr | ||||
| Member functions | ||||
| Modifiers | ||||
| Observers | ||||
| Conversions | ||||
| Non-member functions | ||||
Defined in header <experimental/memory> | ||
template<class W> class observer_ptr; | (library fundamentals TS v2) | |
std::experimental::observer_ptr is a non-owning pointer, orobserver. The observer stores a pointer to a second object, known as thewatched object. Anobserver_ptr may also have no watched object.
An observer is not responsible in any way for the watched object; there is no inherent relationship between an observer and the object it watches.
It is intended as a near drop-in replacement for raw pointer types, with the advantage that, as a vocabulary type, it indicates its intended use without need for detailed analysis by code readers.
Specializations ofobserver_ptr satisfy the requirements ofCopyConstructible andCopyAssignable.
| Type requirements | ||
-W shall not be a reference type, but may be an incomplete type. |
Contents |
| Member type | Definition |
| element_type | W, the type of the object watched by thisobserver_ptr |
constructs a newobserver_ptr(public member function)[edit] | |
(destructor) (implicitly declared) | destructs anobserver_ptr(public member function)[edit] |
operator= (implicitly declared) | implicitly declared copy and move assignment operators that assign the stored pointer (public member function)[edit] |
Modifiers | |
| returns a pointer to the watched object and stops watching the object (public member function)[edit] | |
| replaces the watched object (public member function)[edit] | |
| swaps the watched objects (public member function)[edit] | |
Observers | |
| returns a pointer to the watched object (public member function)[edit] | |
| checks if there is an associated watched object (public member function)[edit] | |
| dereferences pointer to the watched object (public member function)[edit] | |
Conversions | |
| explicit conversion function to the stored pointer (public member function)[edit] | |
creates anobserver_ptr that watches an object(function template)[edit] | |
compares to anotherobserver_ptr or withnullptr(function template)[edit] | |
specializes theswap algorithm(function template)[edit] |
hash support forobserver_ptr(class template specialization)[edit] |
| This section is incomplete Reason: no example |