std::expected<T,E>::operator->, std::expected<T,E>::operator*

< cpp‎ | utility‎ | expected
T 不是 cv void
constexpr const T* operator->() const noexcept;
(1) (C++23 起)
constexpr T* operator->() noexcept;
(1) (C++23 起)
constexpr const T& operator*() const& noexcept;
(2) (C++23 起)
constexpr T& operator*() & noexcept;
(2) (C++23 起)
constexpr const T&& operator*() const&& noexcept;
(2) (C++23 起)
constexpr T&& operator*() && noexcept;
(2) (C++23 起)
T 是 cv void
constexpr void operator*() const noexcept;
(3) (C++23 起)

访问 *this 含有的期待的值

1) 返回指向所含值的指针
2) 返回到所含值的引用
3) 没有返回值

this->has_value()false 则行为未定义。

参数

(无)

返回值

指向所含值的指针或到所含值的引用

示例

参阅

返回期待的值
(公开成员函数)
如果有期待的值则返回它,否则返回另一个值
(公开成员函数)
检查对象是否含有期待的值
(公开成员函数)
返回不期待的值
(公开成员函数)