diff --git a/test/stream_extract.cpp b/test/stream_extract.cpp index 8ccc114..4cfc0cf 100644 --- a/test/stream_extract.cpp +++ b/test/stream_extract.cpp @@ -7,7 +7,20 @@ #include #include -template T from_string( std::string const& s ) +template T from_string_1( std::string const& s ) +{ + using namespace boost::lambda2; + + std::istringstream is( s ); + + T t{}; + + ( std::ref( is ) >> _1 )( t ); + + return t; +} + +template T from_string_2( std::string const& s ) { using namespace boost::lambda2; @@ -22,7 +35,8 @@ template T from_string( std::string const& s ) int main() { - BOOST_TEST_EQ( from_string( "123" ), 123 ); + BOOST_TEST_EQ( from_string_1( "123" ), 123 ); + BOOST_TEST_EQ( from_string_2( "456" ), 456 ); return boost::report_errors(); } diff --git a/test/stream_insert.cpp b/test/stream_insert.cpp index 722091c..b8410ae 100644 --- a/test/stream_insert.cpp +++ b/test/stream_insert.cpp @@ -7,7 +7,18 @@ #include #include -template std::string to_string( T const& t ) +template std::string to_string_1( T const& t ) +{ + using namespace boost::lambda2; + + std::ostringstream os; + + ( std::ref( os ) << _1 )( t ); + + return os.str(); +} + +template std::string to_string_2( T const& t ) { using namespace boost::lambda2; @@ -20,7 +31,8 @@ template std::string to_string( T const& t ) int main() { - BOOST_TEST_EQ( to_string( 123 ), "123" ); + BOOST_TEST_EQ( to_string_1( 123 ), "123" ); + BOOST_TEST_EQ( to_string_2( 456 ), "456" ); return boost::report_errors(); }