std::experimental::observer_ptr::observer_ptr - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::observer_ptr::observer_ptr

From cppreference.com
< cpp‎ | experimental‎ | observer ptr

constexpr observer_ptr(); constexpr observer_ptr( nullptr_t ); | (1) | (library fundamentals TS v2)
explicit observer_ptr( std::add_pointer_t<W> p ); | (2) | (library fundamentals TS v2)
template<class W2> observer_ptr( observer_ptr<W2> other ); | (3) | (library fundamentals TS v2)
observer_ptr( const observer_ptr& other ) = default; | (4) | (library fundamentals TS v2) (implicitly declared)
observer_ptr( observer_ptr&& other ) = default; | (5) | (library fundamentals TS v2) (implicitly declared)

1) Constructs an `observer_ptr` that has no corresponding watched object.
2) Constructs an `observer_ptr` that watches `p`.
3) Constructs an `observer_ptr` that watches `other.get()`. This constructor does not participate in overload resolution unless `W2*` is convertible to `W*`.
4-5) Implicitly declared copy and move constructors. Constructs an `observer_ptr` that watches `other.get()`.

### [edit] Parameters

p | - | a pointer to an object to watch
other | - | another `observer_ptr` to copy from

### [edit] Exceptions

`noexcept` specification:
noexcept
Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/observer_ptr/observer_ptr&oldid=79513"
Category:

- unconditionally noexcept