From 7c74332487cdaeecc209c9439cd50aaa0f2447b9 Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Wed, 20 Aug 2008 08:20:40 +0000 Subject: [PATCH] conform to TR1 to the letter [SVN r48244] --- ...uple_forward_ctor.hpp => tuple_expand.hpp} | 24 ++++++++++--- include/boost/fusion/tuple/tuple.hpp | 36 ++++++++++++++----- 2 files changed, 47 insertions(+), 13 deletions(-) rename include/boost/fusion/tuple/detail/{tuple_forward_ctor.hpp => tuple_expand.hpp} (63%) diff --git a/include/boost/fusion/tuple/detail/tuple_forward_ctor.hpp b/include/boost/fusion/tuple/detail/tuple_expand.hpp similarity index 63% rename from include/boost/fusion/tuple/detail/tuple_forward_ctor.hpp rename to include/boost/fusion/tuple/detail/tuple_expand.hpp index 2ff20a2a..2369f8da 100644 --- a/include/boost/fusion/tuple/detail/tuple_forward_ctor.hpp +++ b/include/boost/fusion/tuple/detail/tuple_expand.hpp @@ -1,19 +1,19 @@ /*============================================================================= 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) ==============================================================================*/ #ifndef BOOST_PP_IS_ITERATING -#if !defined(FUSION_TUPLE_FORWARD_CTOR_10032005_0815) -#define FUSION_TUPLE_FORWARD_CTOR_10032005_0815 +#if !defined(FUSION_TUPLE_EXPAND_10032005_0815) +#define FUSION_TUPLE_EXPAND_10032005_0815 #include #include #include #define BOOST_PP_FILENAME_1 \ - + #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE) #include BOOST_PP_ITERATE() @@ -34,6 +34,22 @@ N, typename detail::call_param::type _)) : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {} + template + tuple(BOOST_PP_ENUM_BINARY_PARAMS( + N, typename detail::call_param::type _)) + : base_type(BOOST_PP_ENUM_PARAMS(N, _)) {} + + template + tuple(tuple const& rhs) + : base_type(rhs) {} + + template + tuple& operator=(tuple const& rhs) + { + base_type::operator=(rhs); + return *this; + } + #undef N #endif // defined(BOOST_PP_IS_ITERATING) diff --git a/include/boost/fusion/tuple/tuple.hpp b/include/boost/fusion/tuple/tuple.hpp index d9860323..4125f42d 100644 --- a/include/boost/fusion/tuple/tuple.hpp +++ b/include/boost/fusion/tuple/tuple.hpp @@ -1,7 +1,7 @@ /*============================================================================= Copyright (c) 2005 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) ==============================================================================*/ #if !defined(FUSION_TUPLE_10032005_0810) @@ -16,6 +16,7 @@ #include #include #include +#include namespace boost { namespace fusion { @@ -23,17 +24,20 @@ namespace boost { namespace fusion struct tuple : vector { typedef vector< - BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> + BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> base_type; tuple() : base_type() {} - - template - tuple(Sequence const& rhs) + + tuple(tuple const& rhs) : base_type(rhs) {} - #include + template + tuple(std::pair const& rhs) + : base_type(rhs) {} + + #include template tuple& @@ -42,16 +46,30 @@ namespace boost { namespace fusion base_type::operator=(rhs); return *this; } + + tuple& + operator=(tuple const& rhs) + { + base_type::operator=(rhs); + return *this; + } + + template + operator=(std::pair const& rhs) + { + base_type::operator=(rhs); + return *this; + } }; - template + template struct tuple_size : result_of::size {}; - template + template struct tuple_element : result_of::value_at_c {}; template - inline typename + inline typename lazy_disable_if< is_const , result_of::at_c