Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Prev Up HomeNext

throw_bad_result_access<EC>

Policy class defining that bad_result_access_with<EC> should be thrown on incorrect wide value observation. The primary purpose of this policy is to enable standing in for P0323 std::expected<T, E> which throws a bad_expected_access<E> on incorrect wide value observation. This is why it is only ever EC which is thrown with bad_result_access_with<EC> on value observation only, and only when there is an error available.

If used in basic_outcome, and the outcome is exceptioned and so no error is available, incorrect wide value observation performs instead:

BOOST_OUTCOME_THROW_EXCEPTION(bad_result_access("no value"));

Incorrect wide error observation performs:

BOOST_OUTCOME_THROW_EXCEPTION(bad_result_access("no error"));

Incorrect wide exception observation performs:

BOOST_OUTCOME_THROW_EXCEPTION(bad_outcome_access("no exception"));

Inherits publicly from base , and its narrow value, error and exception observer policies are inherited from there.

Requires: Nothing.

Namespace: BOOST_OUTCOME_V2_NAMESPACE::policy

Header: <boost/outcome/policy/throw_bad_result_access.hpp>

Last revised: January 23, 2019 at 01:27:31 UTC


Prev Up HomeNext