Merge from Trunk

[SVN r49251]
This commit is contained in:
Joel de Guzman
2008-10-10 14:49:19 +00:00
parent b1ebdd60a6
commit a046e43990
9 changed files with 170 additions and 65 deletions

View File

@ -15,6 +15,71 @@
namespace boost { namespace fusion
{
namespace detail
{
template <typename Cons>
struct cons_deref
{
typedef typename Cons::car_type type;
};
template <typename Cons, int I>
struct cons_advance
{
typedef typename
cons_advance<Cons, I-1>::type::cdr_type
type;
};
template <typename Cons>
struct cons_advance<Cons, 0>
{
typedef Cons type;
};
template <typename Cons>
struct cons_advance<Cons, 1>
{
typedef typename Cons::cdr_type type;
};
template <typename Cons>
struct cons_advance<Cons, 2>
{
#if BOOST_WORKAROUND(BOOST_MSVC, > 1400) // VC8 and above
typedef typename Cons::cdr_type::cdr_type type;
#else
typedef typename Cons::cdr_type _a;
typedef typename _a::cdr_type type;
#endif
};
template <typename Cons>
struct cons_advance<Cons, 3>
{
#if BOOST_WORKAROUND(BOOST_MSVC, > 1400) // VC8 and above
typedef typename Cons::cdr_type::cdr_type::cdr_type type;
#else
typedef typename Cons::cdr_type _a;
typedef typename _a::cdr_type _b;
typedef typename _b::cdr_type type;
#endif
};
template <typename Cons>
struct cons_advance<Cons, 4>
{
#if BOOST_WORKAROUND(BOOST_MSVC, > 1400) // VC8 and above
typedef typename Cons::cdr_type::cdr_type::cdr_type::cdr_type type;
#else
typedef typename Cons::cdr_type _a;
typedef typename _a::cdr_type _b;
typedef typename _b::cdr_type _c;
typedef typename _c::cdr_type type;
#endif
};
}
struct cons_tag;
namespace extension
@ -28,20 +93,8 @@ namespace boost { namespace fusion
template <typename Sequence, typename N>
struct apply
{
typedef typename
mpl::eval_if<
is_const<Sequence>
, add_const<typename Sequence::cdr_type>
, mpl::identity<typename Sequence::cdr_type>
>::type
cdr_type;
typedef typename
mpl::eval_if<
mpl::bool_<N::value == 0>
, mpl::identity<typename Sequence::car_type>
, apply<cdr_type, mpl::int_<N::value-1> >
>
typedef detail::cons_deref<
typename detail::cons_advance<Sequence, N::value>::type>
element;
typedef typename

View File

@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2005-2006 João Abecasis
Copyright (c) 2005-2006 Joao Abecasis
Copyright (c) 2006-2007 Tobias Schwinger
Use modification and distribution are subject to the Boost Software

View File

@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2005-2006 João Abecasis
Copyright (c) 2005-2006 Joao Abecasis
Copyright (c) 2006-2007 Tobias Schwinger
Use modification and distribution are subject to the Boost Software

View File

@ -1,5 +1,5 @@
/*=============================================================================
Copyright (c) 2005-2006 João Abecasis
Copyright (c) 2005-2006 Joao Abecasis
Copyright (c) 2006-2007 Tobias Schwinger
Use modification and distribution are subject to the Boost Software

View File

@ -0,0 +1,12 @@
/*=============================================================================
Copyright (c) 2001-2007 Joel de Guzman
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_INCLUDE_AT_C)
#define FUSION_INCLUDE_AT_C
#include <boost/fusion/sequence/intrinsic/at_c.hpp>
#endif

View File

@ -4,8 +4,8 @@
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_INCLUDE_BEGIN)
#define FUSION_INCLUDE_BEGIN
#if !defined(FUSION_INCLUDE_END)
#define FUSION_INCLUDE_END
#include <boost/fusion/sequence/intrinsic/end.hpp>

View File

@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
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_AT_C_08252008_0308)
#define FUSION_AT_C_08252008_0308
#include <boost/fusion/sequence/intrinsic/at.hpp>
#endif

View File

@ -5,15 +5,15 @@
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 <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#define BOOST_PP_FILENAME_1 \
<boost/fusion/tuple/detail/tuple_forward_ctor.hpp>
<boost/fusion/tuple/detail/tuple_expand.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
#include BOOST_PP_ITERATE()
@ -34,6 +34,17 @@
N, typename detail::call_param<T, >::type _))
: base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
tuple(tuple<BOOST_PP_ENUM_PARAMS(N, U)> const& rhs)
: base_type(rhs) {}
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
tuple& operator=(tuple<BOOST_PP_ENUM_PARAMS(N, U)> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -16,6 +16,7 @@
#include <boost/fusion/sequence/io.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/config/no_tr1/utility.hpp>
namespace boost { namespace fusion
{
@ -29,15 +30,30 @@ namespace boost { namespace fusion
tuple()
: base_type() {}
template <typename Sequence>
tuple(Sequence const& rhs)
tuple(tuple const& rhs)
: base_type(rhs) {}
#include <boost/fusion/tuple/detail/tuple_forward_ctor.hpp>
template <typename U1, typename U2>
tuple(std::pair<U1, U2> const& rhs)
: base_type(rhs) {}
#include <boost/fusion/tuple/detail/tuple_expand.hpp>
template <typename T>
tuple&
operator=(T const& rhs)
tuple& operator=(T const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple& operator=(tuple const& rhs)
{
base_type::operator=(rhs);
return *this;
}
template <typename U1, typename U2>
tuple& operator=(std::pair<U1, U2> const& rhs)
{
base_type::operator=(rhs);
return *this;