mirror of
https://github.com/boostorg/system.git
synced 2025-10-06 20:50:57 +02:00
Add result<U&, E> specialization. Fixes #72.
This commit is contained in:
@@ -181,6 +181,34 @@ int main()
|
||||
|
||||
BOOST_TEST_EQ( X::instances, 0 );
|
||||
|
||||
//
|
||||
|
||||
{
|
||||
int x = 5;
|
||||
|
||||
result<int&> r( x );
|
||||
result<int const&> r2 = r;
|
||||
|
||||
BOOST_TEST( r2 ) && BOOST_TEST_EQ( *r2, 5 );
|
||||
}
|
||||
|
||||
{
|
||||
int x = 6;
|
||||
|
||||
result<int&> const r( x );
|
||||
result<int const&> r2 = r;
|
||||
|
||||
BOOST_TEST( r2 ) && BOOST_TEST_EQ( *r2, 6 );
|
||||
}
|
||||
|
||||
{
|
||||
int x = 7;
|
||||
|
||||
result<int const&> r2 = result<int&>( x );
|
||||
|
||||
BOOST_TEST( r2 ) && BOOST_TEST_EQ( *r2, 7 );
|
||||
}
|
||||
|
||||
{
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_constructible<result<long>, result<int>>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_convertible<result<int>, result<long>>));
|
||||
@@ -196,6 +224,18 @@ int main()
|
||||
|
||||
BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<int, void*>, result<int, int>>));
|
||||
BOOST_TEST_TRAIT_FALSE((std::is_convertible<result<int, int>, result<int, void*>>));
|
||||
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_constructible<result<int const&>, result<int&>>));
|
||||
BOOST_TEST_TRAIT_TRUE((std::is_convertible<result<int&>, result<int const&>>));
|
||||
|
||||
BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<int const&>, result<int>>));
|
||||
BOOST_TEST_TRAIT_FALSE((std::is_convertible<result<int>, result<int const&>>));
|
||||
|
||||
BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<int const&>, result<long&>>));
|
||||
BOOST_TEST_TRAIT_FALSE((std::is_convertible<result<long&>, result<int const&>>));
|
||||
|
||||
BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<int const&>, result<long const&>>));
|
||||
BOOST_TEST_TRAIT_FALSE((std::is_convertible<result<long const&>, result<int const&>>));
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
|
Reference in New Issue
Block a user