std::indirect<T, Allocator>::operator->, std::indirect<T, Allocator>::operator*
来自cppreference.com
| constexpr const_pointer operator->() const noexcept; |
(1) | (C++26 起) |
| constexpr pointer operator->() noexcept; |
(2) | (C++26 起) |
| constexpr const T& operator*() const& noexcept; |
(3) | (C++26 起) |
| constexpr T& operator*() & noexcept; |
(4) | (C++26 起) |
| constexpr const T&& operator*() const&& noexcept; |
(5) | (C++26 起) |
| constexpr T&& operator*() && noexcept; |
(6) | (C++26 起) |
访问拥有的值。
1,2) 返回指向拥有的值的指针。
3-6) 返回到拥有的值的引用。
如果 *this 无值,那么行为未定义。
返回值
1,2)
p3,4) *
p5,6) std::move(*
p )注解
此运算符不检查 *this 是否无值,用户可以手动用 valueless_after_move() 做检查。
示例
| 本节未完成 原因:暂无示例 |