Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76403 - in trunk: boost/exception libs/exception/test
From: emil_at_[hidden]
Date: 2012-01-10 20:13:03


Author: emildotchevski
Date: 2012-01-10 20:13:03 EST (Tue, 10 Jan 2012)
New Revision: 76403
URL: http://svn.boost.org/trac/boost/changeset/76403

Log:
Ticket 6374, thanks edA-qa
Text files modified:
   trunk/boost/exception/info_tuple.hpp | 24 +++++++++++++++++++++++
   trunk/libs/exception/test/error_info_test.cpp | 41 ++++++++++++++++++++++++++++++++++-----
   2 files changed, 59 insertions(+), 6 deletions(-)

Modified: trunk/boost/exception/info_tuple.hpp
==============================================================================
--- trunk/boost/exception/info_tuple.hpp (original)
+++ trunk/boost/exception/info_tuple.hpp 2012-01-10 20:13:03 EST (Tue, 10 Jan 2012)
@@ -19,6 +19,30 @@
 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<Tag1,T1> > const & v )
+ {
+ return x << v.template get<0>();
+ }
+
+ template <
         class E,
         class Tag1,class T1,
         class Tag2,class T2 >

Modified: trunk/libs/exception/test/error_info_test.cpp
==============================================================================
--- trunk/libs/exception/test/error_info_test.cpp (original)
+++ trunk/libs/exception/test/error_info_test.cpp 2012-01-10 20:13:03 EST (Tue, 10 Jan 2012)
@@ -249,12 +249,41 @@
 void
 test_add_tuple()
     {
- typedef boost::tuple<test_1,test_2> test_12;
- typedef boost::tuple<test_1,test_2,test_3> test_123;
- typedef boost::tuple<test_1,test_2,test_3,test_5> test_1235;
+ typedef boost::tuple<> tuple_test_;
+ typedef boost::tuple<test_1> tuple_test_1;
+ typedef boost::tuple<test_1,test_2> tuple_test_12;
+ typedef boost::tuple<test_1,test_2,test_3> tuple_test_123;
+ typedef boost::tuple<test_1,test_2,test_3,test_5> 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<test_1>(x)==42 );
+ }
+ catch(
+ ... )
+ {
+ BOOST_TEST(false);
+ }
+ try
+ {
+ throw test_exception() << tuple_test_12(42,42u);
         }
     catch(
     test_exception & x )
@@ -269,7 +298,7 @@
         }
     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 @@
         }
     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 )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk