Fixed boost::cref invalid for temporary objects

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@759 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2014-11-23 10:54:14 +00:00
parent 5eceba381a
commit 6558254c50
2 changed files with 5 additions and 3 deletions

View file

@ -523,7 +523,8 @@ BOOST_AUTO_TEST_CASE( boost_assign_map_list_of_are_serialized )
BOOST_AUTO_TEST_CASE( boost_reference_wrappers_are_serialized ) BOOST_AUTO_TEST_CASE( boost_reference_wrappers_are_serialized )
{ {
BOOST_CHECK_EQUAL( "3", to_string( boost::cref( 3 ) ) ); const int i = 3;
BOOST_CHECK_EQUAL( "3", to_string( boost::cref( i ) ) );
BOOST_CHECK_EQUAL( "\"string\"", to_string( boost::cref( "string" ) ) ); BOOST_CHECK_EQUAL( "\"string\"", to_string( boost::cref( "string" ) ) );
} }

View file

@ -27,8 +27,9 @@ BOOST_AUTO_TEST_CASE( int_and_int_can_be_compared )
BOOST_AUTO_TEST_CASE( ref_to_int_and_int_can_be_compared ) BOOST_AUTO_TEST_CASE( ref_to_int_and_int_can_be_compared )
{ {
BOOST_CHECK( match( 3, boost::cref( 3 ) ) ); const int i = 3;
BOOST_CHECK( ! match( 4, boost::cref( 3 ) ) ); BOOST_CHECK( match( 3, boost::cref( i ) ) );
BOOST_CHECK( ! match( 4, boost::cref( i ) ) );
} }
namespace namespace