Skip to content

Commit

Permalink
Document the change made in TartanLlama/expected#117
Browse files Browse the repository at this point in the history
Signed-off-by: Daira Hopwood <[email protected]>
  • Loading branch information
daira committed Dec 9, 2022
1 parent 1924fc3 commit a78a03b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions api/expected.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,18 @@ C++11/14/17 `std::expected <https://wg21.link/p0323r3>`_ with functional-style e
.. function:: constexpr T* operator->()
constexpr T const* operator->() const

Returns a pointer to the expected value. Undefined behaviour
if `*this` is in the unexpected state. Use :func:`tl::expected::value`
for checked value retrieval.
Returns a pointer to the expected value. Undefined behaviour (implemented
as an assertion failure) if `*this` is in the unexpected state. Use
:func:`tl::expected::value` for checked value retrieval.

.. function:: constexpr T & operator*() &
constexpr T const & operator*() const &
constexpr T && operator*() &&
constexpr T const && operator*() const &&

Returns the expected value. Undefined behaviour if `*this` is in the unexpected
state. Use :func:`tl::expected::value` for checked value retrieval.
Returns the expected value. Undefined behaviour (implemented as an
assertion failure) if `*this` is in the unexpected state. Use
:func:`tl::expected::value` for checked value retrieval.

.. function:: constexpr T & value() &
constexpr T const & value() const &
Expand All @@ -139,8 +140,8 @@ C++11/14/17 `std::expected <https://wg21.link/p0323r3>`_ with functional-style e
constexpr E const && error() const &&

If `*this` is in the unexpected state, returns the unexpected value.
Undefined behaviour if `*this` is in the expected state.
Use :func:`tl::expected::has_value` or
Undefined behaviour (implemented as an assertion failure) if `*this`
is in the expected state. Use :func:`tl::expected::has_value` or
:func:`tl::expected::operator bool` to check the state before
calling.

Expand Down

0 comments on commit a78a03b

Please sign in to comment.