diff --git a/include/boost/exception/info_tuple.hpp b/include/boost/exception/info_tuple.hpp index 34afe42..bf1be15 100644 --- a/include/boost/exception/info_tuple.hpp +++ b/include/boost/exception/info_tuple.hpp @@ -18,6 +18,30 @@ namespace boost { + template < + class E > + inline + E const & + operator<<( + E const & x, + tuple< > const & v ) + { + return x; + } + + template < + class E, + class Tag1,class T1 > + inline + E const & + operator<<( + E const & x, + tuple< + error_info > const & v ) + { + return x << v.template get<0>(); + } + template < class E, class Tag1,class T1, diff --git a/test/error_info_test.cpp b/test/error_info_test.cpp index 53a6d12..f3dda1a 100644 --- a/test/error_info_test.cpp +++ b/test/error_info_test.cpp @@ -249,12 +249,41 @@ test_catch_add_info() void test_add_tuple() { - typedef boost::tuple test_12; - typedef boost::tuple test_123; - typedef boost::tuple test_1235; + typedef boost::tuple<> tuple_test_; + typedef boost::tuple tuple_test_1; + typedef boost::tuple tuple_test_12; + typedef boost::tuple tuple_test_123; + typedef boost::tuple tuple_test_1235; try { - throw test_exception() << test_12(42,42u); + throw test_exception() << tuple_test_(); + } + catch( + test_exception & x ) + { + } + catch( + ... ) + { + BOOST_TEST(false); + } + try + { + throw test_exception() << tuple_test_1(42); + } + catch( + test_exception & x ) + { + BOOST_TEST( *boost::get_error_info(x)==42 ); + } + catch( + ... ) + { + BOOST_TEST(false); + } + try + { + throw test_exception() << tuple_test_12(42,42u); } catch( test_exception & x ) @@ -269,7 +298,7 @@ test_add_tuple() } try { - throw test_exception() << test_123(42,42u,42.0f); + throw test_exception() << tuple_test_123(42,42u,42.0f); } catch( test_exception & x ) @@ -285,7 +314,7 @@ test_add_tuple() } try { - throw test_exception() << test_1235(42,42u,42.0f,std::string("42")); + throw test_exception() << tuple_test_1235(42,42u,42.0f,std::string("42")); } catch( test_exception & x )