mirror of
https://github.com/boostorg/system.git
synced 2026-07-06 08:20:52 +02:00
Change operator* and operator-> to throw instead of having a precondition
This commit is contained in:
@@ -27,6 +27,15 @@ struct X
|
||||
|
||||
int X::instances = 0;
|
||||
|
||||
struct E
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_NORETURN void throw_exception_from_error( X const &, boost::source_location const& )
|
||||
{
|
||||
throw E();
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -53,7 +62,7 @@ int main()
|
||||
BOOST_TEST( r.has_value() );
|
||||
BOOST_TEST( !r.has_error() );
|
||||
|
||||
BOOST_TEST_EQ( *r, 1 );
|
||||
BOOST_TEST_EQ( r.unsafe_value(), 1 );
|
||||
}
|
||||
|
||||
BOOST_TEST_EQ( X::instances, 0 );
|
||||
|
||||
Reference in New Issue
Block a user