std::indirect<T, Allocator>::operator->, std::indirect<T, Allocator>::operator*
constexpr const_pointer operator->() const noexcept; | (1) | (since C++26) |
constexpr pointer operator->() noexcept; | (2) | (since C++26) |
constexpr const T& operator*() const& noexcept; | (3) | (since C++26) |
constexpr T& operator*() & noexcept; | (4) | (since C++26) |
constexpr const T&& operator*() const&& noexcept; | (5) | (since C++26) |
constexpr T&& operator*() && noexcept; | (6) | (since C++26) |
Accesses the owned value.
1,2) Returns a pointer to the owned value.
3-6) Returns a reference to the owned value.
If *this is valueless, the behavior is undefined.
Return value
1,2)
p
3,4)
*p
5,6)
std::move(*p )
Notes
This operator does not check whether *this is valueless, users can do so manually by using valueless_after_move().
Example
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/memory/indirect/operator*