diff --git a/test/Jamfile b/test/Jamfile index b6101e3d..12407035 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -89,6 +89,7 @@ import testing ; [ run sequence/tuple_misc.cpp : : : : ] [ run sequence/tuple_mutate.cpp : : : : ] [ run sequence/tuple_tie.cpp : : : : ] + [ run sequence/tr1_tuple_auto_conv.cpp : : : : ] [ run sequence/transform_view.cpp : : : : ] [ run sequence/vector_comparison.cpp : : : : ] [ run sequence/vector_construction.cpp : : : : ] diff --git a/test/sequence/construction.hpp b/test/sequence/construction.hpp index c667b1a4..5c6abdf2 100644 --- a/test/sequence/construction.hpp +++ b/test/sequence/construction.hpp @@ -2,7 +2,7 @@ Copyright (c) 1999-2003 Jaakko Jarvi Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #include @@ -57,7 +57,9 @@ test() FUSION_SEQUENCE<> empty0; +#ifndef TR1_TUPLE_TEST FUSION_SEQUENCE<> empty1(empty); +#endif FUSION_SEQUENCE t1; BOOST_TEST(FUSION_AT<0>(t1) == int()); diff --git a/test/sequence/tr1_tuple_auto_conv.cpp b/test/sequence/tr1_tuple_auto_conv.cpp new file mode 100644 index 00000000..0c20fa3f --- /dev/null +++ b/test/sequence/tr1_tuple_auto_conv.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include + +namespace Core +{ + class AutoConverter + { + std::tr1::shared_ptr t_; + + public: + AutoConverter(std::tr1::shared_ptr const & t) + : t_(t) + {} + + template + operator C () + { + try + { + boost::any & a = (*t_); + + return boost::any_cast(a); + } + catch(boost::bad_any_cast & e) + { + std::cerr << "Internal conversion bug: " + << "Failed to convert data holder to " + << typeid(C).name() << "\n" + << e.what() + << std::endl; + + C c = C(); + return c; + } + } + }; + + + inline AutoConverter Demo() + { + std::tr1::shared_ptr p_result + (new boost::any(std::tr1::make_tuple(1, 2, 3, 4))); + return p_result; + } + +} // namespace Core + + +int main(int argc, char* argv[]) +{ + std::tr1::tuple test = Core::Demo(); + return 0; +} + diff --git a/test/sequence/tuple_construction.cpp b/test/sequence/tuple_construction.cpp index 7f025d51..ec602abb 100644 --- a/test/sequence/tuple_construction.cpp +++ b/test/sequence/tuple_construction.cpp @@ -2,12 +2,13 @@ Copyright (c) 1999-2003 Jaakko Jarvi Copyright (c) 2001-2006 Joel de Guzman - Distributed under the Boost Software License, Version 1.0. (See accompanying + Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #include #include +#define TR1_TUPLE_TEST #define FUSION_SEQUENCE tuple #define FUSION_AT get #include "construction.hpp"