|
Boost-Commit : |
From: joel_at_[hidden]
Date: 2008-08-20 04:20:20
Author: djowel
Date: 2008-08-20 04:20:19 EDT (Wed, 20 Aug 2008)
New Revision: 48243
URL: http://svn.boost.org/trac/boost/changeset/48243
Log:
conform to TR1 to the letter
Added:
trunk/libs/fusion/test/sequence/tr1_tuple_auto_conv.cpp (contents, props changed)
Text files modified:
trunk/libs/fusion/test/Jamfile | 1 +
trunk/libs/fusion/test/sequence/construction.hpp | 4 +++-
trunk/libs/fusion/test/sequence/tuple_construction.cpp | 3 ++-
3 files changed, 6 insertions(+), 2 deletions(-)
Modified: trunk/libs/fusion/test/Jamfile
==============================================================================
--- trunk/libs/fusion/test/Jamfile (original)
+++ trunk/libs/fusion/test/Jamfile 2008-08-20 04:20:19 EDT (Wed, 20 Aug 2008)
@@ -89,6 +89,7 @@
[ 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 : : : : ]
Modified: trunk/libs/fusion/test/sequence/construction.hpp
==============================================================================
--- trunk/libs/fusion/test/sequence/construction.hpp (original)
+++ trunk/libs/fusion/test/sequence/construction.hpp 2008-08-20 04:20:19 EDT (Wed, 20 Aug 2008)
@@ -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 <boost/detail/lightweight_test.hpp>
@@ -57,7 +57,9 @@
FUSION_SEQUENCE<> empty0;
+#ifndef TR1_TUPLE_TEST
FUSION_SEQUENCE<> empty1(empty);
+#endif
FUSION_SEQUENCE<int> t1;
BOOST_TEST(FUSION_AT<0>(t1) == int());
Added: trunk/libs/fusion/test/sequence/tr1_tuple_auto_conv.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/fusion/test/sequence/tr1_tuple_auto_conv.cpp 2008-08-20 04:20:19 EDT (Wed, 20 Aug 2008)
@@ -0,0 +1,56 @@
+#include <boost/tr1/memory.hpp>
+#include <boost/tr1/tuple.hpp>
+#include <boost/any.hpp>
+#include <iostream>
+
+namespace Core
+{
+ class AutoConverter
+ {
+ std::tr1::shared_ptr<boost::any> t_;
+
+ public:
+ AutoConverter(std::tr1::shared_ptr<boost::any> const & t)
+ : t_(t)
+ {}
+
+ template <typename C>
+ operator C ()
+ {
+ try
+ {
+ boost::any & a = (*t_);
+
+ return boost::any_cast<C>(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<boost::any> 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<int, int, int, int> test = Core::Demo();
+ return 0;
+}
+
Modified: trunk/libs/fusion/test/sequence/tuple_construction.cpp
==============================================================================
--- trunk/libs/fusion/test/sequence/tuple_construction.cpp (original)
+++ trunk/libs/fusion/test/sequence/tuple_construction.cpp 2008-08-20 04:20:19 EDT (Wed, 20 Aug 2008)
@@ -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 <boost/fusion/tuple/tuple.hpp>
#include <boost/fusion/adapted/mpl.hpp>
+#define TR1_TUPLE_TEST
#define FUSION_SEQUENCE tuple
#define FUSION_AT get
#include "construction.hpp"
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