branch for creating branch for fusion 2.1

[SVN r40237]
This commit is contained in:
Joel de Guzman
2007-10-21 00:52:09 +00:00
parent 7a6e82b7cf
commit 32f1c58ce7
476 changed files with 25709 additions and 0 deletions

View File

@ -0,0 +1,15 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_SEQUENCE_CONTAINER_DEQUE_24112006_2036)
#define BOOST_FUSION_SEQUENCE_CONTAINER_DEQUE_24112006_2036
#include <boost/fusion/container/deque/deque.hpp>
#include <boost/fusion/container/deque/convert.hpp>
#endif

View File

@ -0,0 +1,37 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_BACK_EXTENDED_DEQUE_26112006_2209)
#define BOOST_FUSION_BACK_EXTENDED_DEQUE_26112006_2209
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
namespace boost { namespace fusion {
template<typename Deque, typename T>
struct back_extended_deque
: detail::keyed_element<typename Deque::next_up, T, Deque>,
sequence_base<back_extended_deque<Deque, T> >
{
typedef detail::keyed_element<typename Deque::next_up, T, Deque> base;
typedef typename Deque::next_down next_down;
typedef mpl::int_<mpl::plus<typename Deque::next_up, mpl::int_<1> >::value> next_up;
typedef mpl::plus<typename result_of::size<Deque>::type, mpl::int_<1> > size;
back_extended_deque(Deque const& deque, typename add_reference<typename add_const<T>::type>::type t)
: base(t, deque)
{}
};
}}
#endif

View File

@ -0,0 +1,48 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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_CONVERT_20061213_2207)
#define FUSION_CONVERT_20061213_2207
#include <boost/fusion/container/deque/detail/as_deque.hpp>
#include <boost/fusion/container/deque/detail/convert_impl.hpp>
#include <boost/fusion/container/deque/deque.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence>
struct as_deque
{
typedef typename detail::as_deque<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
};
}
template <typename Sequence>
inline typename result_of::as_deque<Sequence>::type
as_deque(Sequence& seq)
{
typedef typename result_of::as_deque<Sequence>::gen gen;
return gen::call(fusion::begin(seq));
}
template <typename Sequence>
inline typename result_of::as_deque<Sequence const>::type
as_deque(Sequence const& seq)
{
typedef typename result_of::as_deque<Sequence const>::gen gen;
return gen::call(fusion::begin(seq));
}
}}
#endif

View File

@ -0,0 +1,93 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_26112006_1649)
#define BOOST_FUSION_DEQUE_26112006_1649
#include <boost/fusion/container/deque/limits.hpp>
#include <boost/fusion/container/deque/front_extended_deque.hpp>
#include <boost/fusion/container/deque/back_extended_deque.hpp>
#include <boost/fusion/container/deque/detail/deque_keyed_values.hpp>
#include <boost/fusion/container/deque/detail/deque_initial_size.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/fusion/container/deque/deque_fwd.hpp>
#include <boost/fusion/container/deque/detail/value_at_impl.hpp>
#include <boost/fusion/container/deque/detail/at_impl.hpp>
#include <boost/fusion/container/deque/detail/begin_impl.hpp>
#include <boost/fusion/container/deque/detail/end_impl.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/void.hpp>
#include <boost/utility/enable_if.hpp>
namespace boost { namespace fusion {
struct deque_tag;
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
struct deque
:
detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type,
sequence_base<deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)> >
{
typedef deque_tag fusion_tag;
typedef typename detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type base;
typedef typename detail::deque_initial_size<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type size;
typedef mpl::int_<size::value> next_up;
typedef mpl::int_<
mpl::if_<mpl::equal_to<size, mpl::int_<0> >, mpl::int_<0>, mpl::int_<-1> >::type::value> next_down;
typedef mpl::false_ is_view;
#include <boost/fusion/container/deque/detail/deque_forward_ctor.hpp>
deque()
{}
explicit deque(typename add_reference<typename add_const<T0>::type>::type t0)
: base(t0, detail::nil_keyed_element())
{}
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
deque(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& seq)
: base(seq)
{}
template<typename Sequence>
deque(Sequence const& seq, typename disable_if<is_convertible<Sequence, T0> >::type* dummy = 0)
: base(base::from_iterator(fusion::begin(seq)))
{}
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename U)>
deque&
operator=(deque<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, U)> const& rhs)
{
base::operator=(rhs);
return *this;
}
template <typename T>
deque&
operator=(T const& rhs)
{
base::operator=(rhs);
return *this;
}
};
}}
#endif

View File

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2005-2007 Joel de Guzman
Copyright (c) 2005-2007 Dan Marsden
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_DEQUE_FORWARD_02092007_0749)
#define FUSION_DEQUE_FORWARD_02092007_0749
#include <boost/fusion/container/deque/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
namespace boost { namespace fusion
{
struct void_;
template<
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
FUSION_MAX_DEQUE_SIZE, typename T, void_)>
struct deque;
}}
#endif

View File

@ -0,0 +1,106 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_ITERATOR_26112006_2154)
#define BOOST_FUSION_DEQUE_ITERATOR_26112006_2154
#include <boost/fusion/iterator/iterator_facade.hpp>
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/mpl/equal_to.hpp>
namespace boost { namespace fusion {
struct bidirectional_traversal_tag;
template<typename Seq, int Pos>
struct deque_iterator
: iterator_facade<deque_iterator<Seq, Pos>, bidirectional_traversal_tag>
{
typedef Seq sequence;
typedef mpl::int_<Pos> index;
deque_iterator(Seq& seq)
: seq_(seq)
{}
template<typename Iterator>
struct value_of
: detail::keyed_element_value_at<
typename Iterator::sequence, typename Iterator::index>
{};
template<typename Iterator>
struct deref
{
typedef typename detail::keyed_element_value_at<
typename Iterator::sequence, typename Iterator::index>::type element_type;
typedef typename add_reference<
typename mpl::eval_if<
is_const<typename Iterator::sequence>,
add_const<element_type>,
mpl::identity<element_type> >::type>::type type;
static type
call(Iterator const& it)
{
return it.seq_.get(typename Iterator::index());
}
};
template <typename Iterator, typename N>
struct advance
{
typedef typename Iterator::index index;
typedef typename Iterator::sequence sequence;
typedef deque_iterator<sequence, index::value + N::value> type;
static type
call(Iterator const& i)
{
return type(i.seq_);
}
};
template<typename Iterator>
struct next
: advance<Iterator, mpl::int_<1> >
{};
template<typename Iterator>
struct prior
: advance<Iterator, mpl::int_<-1> >
{};
template <typename I1, typename I2>
struct distance : mpl::minus<typename I2::index, typename I1::index>
{
typedef typename
mpl::minus<
typename I2::index, typename I1::index
>::type
type;
static type
call(I1 const&, I2 const&)
{
return type();
}
};
template<typename I1, typename I2>
struct equal_to
: mpl::equal_to<typename I1::index, typename I2::index>
{};
Seq& seq_;
};
}}
#endif

View File

@ -0,0 +1,102 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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_AS_DEQUE_20061213_2210)
#define FUSION_AS_DEQUE_20061213_2210
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/inc.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/fusion/container/deque/deque.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
namespace boost { namespace fusion { namespace detail
{
template <int size>
struct as_deque;
template <>
struct as_deque<0>
{
template <typename Iterator>
struct apply
{
typedef deque<> type;
};
template <typename Iterator>
static typename apply<Iterator>::type
call(Iterator)
{
return deque<>();
}
};
#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
BOOST_PP_CAT(I, BOOST_PP_INC(n));
#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
BOOST_PP_CAT(T, n);
#define BOOST_PP_FILENAME_1 <boost/fusion/container/deque/detail/as_deque.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
#include BOOST_PP_ITERATE()
#undef BOOST_FUSION_NEXT_ITERATOR
#undef BOOST_FUSION_NEXT_CALL_ITERATOR
#undef BOOST_FUSION_VALUE_OF_ITERATOR
}}}
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
template <>
struct as_deque<N>
{
template <typename I0>
struct apply
{
BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
typedef deque<BOOST_PP_ENUM_PARAMS(N, T)> type;
};
template <typename Iterator>
static typename apply<Iterator>::type
call(Iterator const& i0)
{
typedef apply<Iterator> gen;
typedef typename gen::type result;
BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
return result(BOOST_PP_ENUM_PARAMS(N, *i));
}
};
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,59 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_AT_IMPL_09122006_2017)
#define BOOST_FUSION_DEQUE_AT_IMPL_09122006_2017
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
namespace boost { namespace fusion {
struct deque_tag;
namespace extension
{
template<typename T>
struct at_impl;
template<>
struct at_impl<deque_tag>
{
template<typename Sequence, typename N>
struct apply
{
typedef typename Sequence::next_up next_up;
typedef typename Sequence::next_down next_down;
BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
typedef mpl::plus<next_down, mpl::int_<1> > offset;
typedef mpl::int_<mpl::plus<N, offset>::value> adjusted_index;
typedef typename detail::keyed_element_value_at<Sequence, adjusted_index>::type element_type;
typedef typename add_reference<
typename mpl::eval_if<
is_const<Sequence>,
add_const<element_type>,
mpl::identity<element_type> >::type>::type type;
static type call(Sequence& seq)
{
return seq.get(adjusted_index());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,46 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_BEGIN_IMPL_09122006_2034)
#define BOOST_FUSION_DEQUE_BEGIN_IMPL_09122006_2034
#include <boost/fusion/container/deque/deque_iterator.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion {
struct deque_tag;
namespace extension
{
template<typename T>
struct begin_impl;
template<>
struct begin_impl<deque_tag>
{
template<typename Sequence>
struct apply
{
typedef typename mpl::if_<
mpl::equal_to<typename Sequence::next_down, typename Sequence::next_up>,
deque_iterator<Sequence, 0>,
deque_iterator<
Sequence, mpl::plus<typename Sequence::next_down, mpl::int_<1> >::value> >::type type;
static type call(Sequence& seq)
{
return type(seq);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,45 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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_CONVERT_IMPL_20061213_2207)
#define FUSION_CONVERT_IMPL_20061213_2207
#include <boost/fusion/container/deque/detail/as_deque.hpp>
#include <boost/fusion/container/deque/deque.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
namespace boost { namespace fusion
{
struct deque_tag;
namespace extension
{
template <typename T>
struct convert_impl;
template <>
struct convert_impl<deque_tag>
{
template <typename Sequence>
struct apply
{
typedef typename detail::as_deque<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
static type call(Sequence& seq)
{
return gen::call(fusion::begin(seq));
}
};
};
}
}}
#endif

View File

@ -0,0 +1,31 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_PP_IS_ITERATING)
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212)
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_FORWARD_CTOR_04122006_2212
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#define BOOST_PP_FILENAME_1 \
<boost/fusion/container/deque/detail/deque_forward_ctor.hpp>
#define BOOST_PP_ITERATION_LIMITS (2, FUSION_MAX_DEQUE_SIZE)
#include BOOST_PP_ITERATE()
#endif
#else
#define N BOOST_PP_ITERATION()
deque(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<typename add_const<T, >::type>::type t))
: base(detail::deque_keyed_values<BOOST_PP_ENUM_PARAMS(N, T)>::call(BOOST_PP_ENUM_PARAMS(N, t)))
{}
#undef N
#endif

View File

@ -0,0 +1,33 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139)
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_INITIAL_SIZE_26112006_2139
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/mpl/find.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/mpl/distance.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/vector.hpp>
namespace boost { namespace fusion {
struct void_;
namespace detail {
template<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
struct deque_initial_size
{
typedef mpl::vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)> args;
typedef typename mpl::find<args, void_>::type first_void;
typedef typename mpl::distance<typename mpl::begin<args>::type, first_void>::type type;
};
}}}
#endif

View File

@ -0,0 +1,75 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330)
#define BOOST_FUSION_DEQUE_DETAIL_DEQUE_KEYED_VALUES_26112006_1330
#include <boost/fusion/container/deque/limits.hpp>
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/print.hpp>
#define FUSION_VOID(z, n, _) void_
namespace boost { namespace fusion {
struct void_;
namespace detail {
template<typename Key, typename Value, typename Rest>
struct keyed_element;
struct nil_keyed_element;
template<typename N, BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_DEQUE_SIZE, typename T, void_)>
struct deque_keyed_values_impl;
template<typename N>
struct deque_keyed_values_impl<N, BOOST_PP_ENUM(FUSION_MAX_DEQUE_SIZE, FUSION_VOID, _)>
{
typedef nil_keyed_element type;
static type call()
{
return type();
}
};
template<typename N, BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, typename T)>
struct deque_keyed_values_impl
{
typedef mpl::int_<mpl::plus<N, mpl::int_<1> >::value> next_index;
typedef typename deque_keyed_values_impl<
next_index,
BOOST_PP_ENUM_SHIFTED_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>::type tail;
typedef keyed_element<N, T0, tail> type;
#include <boost/fusion/container/deque/detail/deque_keyed_values_call.hpp>
};
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(FUSION_MAX_DEQUE_SIZE, typename T, void_)>
struct deque_keyed_values
: deque_keyed_values_impl<mpl::int_<0>, BOOST_PP_ENUM_PARAMS(FUSION_MAX_DEQUE_SIZE, T)>
{};
}}}
#undef FUSION_VOID
#endif

View File

@ -0,0 +1,38 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_PP_IS_ITERATING)
#if !defined(BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211)
#define BOOST_FUSION_SEQUENCE_DEQUE_DETAIL_DEQUE_KEYED_VALUES_CALL_04122006_2211
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#define BOOST_PP_FILENAME_1 \
<boost/fusion/container/deque/detail/deque_keyed_values_call.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_DEQUE_SIZE)
#include BOOST_PP_ITERATE()
#endif
#else
#define N BOOST_PP_ITERATION()
static type call(BOOST_PP_ENUM_BINARY_PARAMS(N, typename add_reference<typename add_const<T, >::type>::type t))
{
return type(t0,
deque_keyed_values_impl<
next_index
#if N > 1
, BOOST_PP_ENUM_SHIFTED_PARAMS(N, T)
#endif
>::call(BOOST_PP_ENUM_SHIFTED_PARAMS(N, t)));
}
#undef N
#endif

View File

@ -0,0 +1,46 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_END_IMPL_09122006_2034)
#define BOOST_FUSION_DEQUE_END_IMPL_09122006_2034
#include <boost/fusion/container/deque/deque_iterator.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/if.hpp>
namespace boost { namespace fusion {
struct deque_tag;
namespace extension
{
template<typename T>
struct end_impl;
template<>
struct end_impl<deque_tag>
{
template<typename Sequence>
struct apply
{
typedef typename mpl::if_<
mpl::equal_to<typename Sequence::next_down, typename Sequence::next_up>,
deque_iterator<Sequence, 0>,
deque_iterator<
Sequence, Sequence::next_up::value> >::type type;
static type call(Sequence& seq)
{
return type(seq);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,111 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330)
#define BOOST_FUSION_DEQUE_DETAIL_KEYED_ELEMENT_26112006_1330
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
namespace boost { namespace fusion {
struct fusion_sequence_tag;
namespace detail {
struct nil_keyed_element
{
typedef fusion_sequence_tag tag;
void get();
template<typename It>
static nil_keyed_element
from_iterator(It const&)
{
return nil_keyed_element();
}
};
template<typename Key, typename Value, typename Rest>
struct keyed_element
: Rest
{
typedef Rest base;
typedef fusion_sequence_tag tag;
using Rest::get;
template<typename It>
static keyed_element
from_iterator(It const& it)
{
return keyed_element(
*it, base::from_iterator(fusion::next(it)));
}
template<typename U, typename Rst>
keyed_element(keyed_element<Key, U, Rst> const& rhs)
: Rest(rhs.get_base()), value_(rhs.value_)
{}
Rest const get_base() const
{
return *this;
}
typename add_reference<typename add_const<Value>::type>::type get(Key) const
{
return value_;
}
typename add_reference<Value>::type get(Key)
{
return value_;
}
keyed_element(typename add_reference<typename add_const<Value>::type>::type value, Rest const& rest)
: Rest(rest), value_(value)
{}
keyed_element()
: Rest(), value_()
{}
template<typename U, typename Rst>
keyed_element& operator=(keyed_element<Key, U, Rst> const& rhs)
{
base::operator=(static_cast<Rst const&>(rhs)); // cast for msvc-7.1
value_ = rhs.value_;
return *this;
}
keyed_element& operator=(keyed_element const& rhs)
{
base::operator=(rhs);
value_ = rhs.value_;
return *this;
}
Value value_;
};
template<typename Elem, typename Key>
struct keyed_element_value_at
: keyed_element_value_at<typename Elem::base, Key>
{};
template<typename Key, typename Value, typename Rest>
struct keyed_element_value_at<keyed_element<Key, Value, Rest>, Key>
{
typedef Value type;
};
}}}
#endif

View File

@ -0,0 +1,43 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_VALUE_AT_IMPL_08122006_0756)
#define BOOST_FUSION_DEQUE_VALUE_AT_IMPL_08122006_0756
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/assert.hpp>
namespace boost { namespace fusion {
struct deque_tag;
namespace extension
{
template<typename T>
struct value_at_impl;
template<>
struct value_at_impl<deque_tag>
{
template<typename Sequence, typename N>
struct apply
{
typedef typename Sequence::next_up next_up;
typedef typename Sequence::next_down next_down;
BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
typedef mpl::plus<next_down, mpl::int_<1> > offset;
typedef mpl::int_<mpl::plus<N, offset>::value> adjusted_index;
typedef typename detail::keyed_element_value_at<Sequence, adjusted_index>::type type;
};
};
}
}}
#endif

View File

@ -0,0 +1,39 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209)
#define BOOST_FUSION_FRONT_EXTENDED_DEQUE_26112006_2209
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/minus.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/fusion/support/sequence_base.hpp>
namespace boost { namespace fusion {
template<typename Deque, typename T>
struct front_extended_deque
: detail::keyed_element<typename Deque::next_down, T, Deque>,
sequence_base<front_extended_deque<Deque, T> >
{
typedef detail::keyed_element<typename Deque::next_down, T, Deque> base;
typedef mpl::int_<mpl::minus<typename Deque::next_down, mpl::int_<1> >::value> next_down;
typedef typename Deque::next_up next_up;
typedef mpl::plus<typename result_of::size<Deque>::type, mpl::int_<1> > size;
front_extended_deque(Deque const& deque, typename add_reference<typename add_const<T>::type>::type t)
: base(t, deque)
{}
};
}}
#endif

View File

@ -0,0 +1,15 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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(BOOST_FUSION_DEQUE_LIMITS_26112006_1737)
#define BOOST_FUSION_DEQUE_LIMITS_26112006_1737
#if !defined(FUSION_MAX_DEQUE_SIZE)
#define FUSION_MAX_DEQUE_SIZE 10
#endif
#endif

View File

@ -0,0 +1,130 @@
/*=============================================================================
Copyright (c) 2006 Eric Niebler
Use, modification and distribution is subject to 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 FUSION_BINARY_TREE_EAN_05032006_1027
#define FUSION_BINARY_TREE_EAN_05032006_1027
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/sequence/intrinsic/at.hpp>
#include <boost/fusion/view/single_view.hpp>
#include <boost/fusion/container/list/cons.hpp> // for nil
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/sequence/intrinsic/ext_/segments.hpp>
#include <boost/fusion/support/ext_/is_segmented.hpp>
#include <boost/fusion/view/ext_/segmented_iterator.hpp>
namespace boost { namespace fusion
{
struct tree_tag;
namespace detail
{
template<typename T, bool IsConst>
struct reference : add_reference<T> {};
template<typename T>
struct reference<T, true> : reference<typename add_const<T>::type, false> {};
template<typename T>
struct reference<T &, true> : reference<T, false> {};
}
template<typename Data, typename Left = nil, typename Right = nil>
struct tree
: sequence_base<tree<Data, Left, Right> >
{
typedef Data data_type;
typedef Left left_type;
typedef Right right_type;
typedef tree_tag fusion_tag;
typedef forward_traversal_tag category;
typedef mpl::false_ is_view;
typedef typename mpl::if_<
traits::is_sequence<Data>
, Data
, single_view<Data>
>::type data_view;
explicit tree(
typename fusion::detail::call_param<Data>::type data_
, typename fusion::detail::call_param<Left>::type left_ = Left()
, typename fusion::detail::call_param<Right>::type right_ = Right()
)
: segments(left_, data_view(data_), right_)
{}
typedef vector3<Left, data_view, Right> segments_type;
segments_type segments;
};
template<typename Data>
tree<Data> make_tree(Data const &data)
{
return tree<Data>(data);
}
template<typename Data, typename Left, typename Right>
tree<Data, Left, Right> make_tree(Data const &data, Left const &left, Right const &right)
{
return tree<Data, Left, Right>(data, left, right);
}
namespace extension
{
template<>
struct is_segmented_impl<tree_tag>
{
template<typename Sequence>
struct apply : mpl::true_ {};
};
template<>
struct segments_impl<tree_tag>
{
template<typename Sequence>
struct apply
{
typedef typename mpl::if_<
is_const<Sequence>
, typename Sequence::segments_type const &
, typename Sequence::segments_type &
>::type type;
static type call(Sequence &seq)
{
return seq.segments;
}
};
};
template<>
struct begin_impl<tree_tag>
{
template<typename Sequence>
struct apply
: segmented_begin<Sequence>
{};
};
template<>
struct end_impl<tree_tag>
{
template<typename Sequence>
struct apply
: segmented_end<Sequence>
{};
};
}
}}
#endif

View File

@ -0,0 +1,17 @@
/*=============================================================================
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_SEQUENCE_CLASS_LIST_10022005_0605)
#define FUSION_SEQUENCE_CLASS_LIST_10022005_0605
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/list/cons_iterator.hpp>
#include <boost/fusion/container/list/limits.hpp>
#include <boost/fusion/container/list/list.hpp>
#include <boost/fusion/container/list/list_fwd.hpp>
#include <boost/fusion/container/list/convert.hpp>
#endif

View File

@ -0,0 +1,143 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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_CONS_07172005_0843)
#define FUSION_CONS_07172005_0843
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/container/list/cons_iterator.hpp>
#include <boost/fusion/container/list/detail/begin_impl.hpp>
#include <boost/fusion/container/list/detail/end_impl.hpp>
#include <boost/fusion/container/list/detail/at_impl.hpp>
#include <boost/fusion/container/list/detail/value_at_impl.hpp>
#include <boost/fusion/container/list/detail/empty_impl.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/or.hpp>
namespace boost { namespace fusion
{
struct void_;
struct cons_tag;
struct forward_traversal_tag;
struct fusion_sequence_tag;
struct nil : sequence_base<nil>
{
typedef mpl::int_<0> size;
typedef cons_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef forward_traversal_tag category;
typedef void_ car_type;
typedef void_ cdr_type;
nil() {}
template <typename Iterator>
nil(Iterator const& iter, mpl::true_ /*this_is_an_iterator*/)
{}
template <typename Iterator>
void assign_from_iter(Iterator const& iter)
{
}
};
template <typename Car, typename Cdr = nil>
struct cons : sequence_base<cons<Car, Cdr> >
{
typedef mpl::int_<Cdr::size::value+1> size;
typedef cons_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef forward_traversal_tag category;
typedef Car car_type;
typedef Cdr cdr_type;
cons()
: car(), cdr() {}
explicit cons(typename detail::call_param<Car>::type car)
: car(car), cdr() {}
cons(
typename detail::call_param<Car>::type car
, typename detail::call_param<Cdr>::type cdr)
: car(car), cdr(cdr) {}
template <typename Car2, typename Cdr2>
cons(cons<Car2, Cdr2> const& rhs)
: car(rhs.car), cdr(rhs.cdr) {}
cons(cons const& rhs)
: car(rhs.car), cdr(rhs.cdr) {}
template <typename Sequence>
cons(
Sequence const& seq
, typename disable_if<
mpl::or_<
is_convertible<Sequence, cons> // use copy ctor instead
, is_convertible<Sequence, Car> // use copy to car instead
>
>::type* dummy = 0
)
: car(*fusion::begin(seq))
, cdr(fusion::next(fusion::begin(seq)), mpl::true_()) {}
template <typename Iterator>
cons(Iterator const& iter, mpl::true_ /*this_is_an_iterator*/)
: car(*iter)
, cdr(fusion::next(iter), mpl::true_()) {}
template <typename Car2, typename Cdr2>
cons& operator=(cons<Car2, Cdr2> const& rhs)
{
car = rhs.car;
cdr = rhs.cdr;
return *this;
}
cons& operator=(cons const& rhs)
{
car = rhs.car;
cdr = rhs.cdr;
return *this;
}
template <typename Sequence>
typename disable_if<is_convertible<Sequence, Car>, cons&>::type
operator=(Sequence const& seq)
{
typedef typename result_of::begin<Sequence const>::type Iterator;
Iterator iter = fusion::begin(seq);
this->assign_from_iter(iter);
return *this;
}
template <typename Iterator>
void assign_from_iter(Iterator const& iter)
{
car = *iter;
cdr.assign_from_iter(fusion::next(iter));
}
car_type car;
cdr_type cdr;
};
}}
#endif

View File

@ -0,0 +1,85 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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_CONS_ITERATOR_07172005_0849)
#define FUSION_CONS_ITERATOR_07172005_0849
#include <boost/type_traits/add_const.hpp>
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/container/list/detail/deref_impl.hpp>
#include <boost/fusion/container/list/detail/next_impl.hpp>
#include <boost/fusion/container/list/detail/value_of_impl.hpp>
#include <boost/fusion/container/list/detail/equal_to_impl.hpp>
#include <boost/fusion/container/list/list_fwd.hpp>
namespace boost { namespace fusion
{
struct nil;
struct cons_iterator_tag;
struct forward_traversal_tag;
template <typename Cons>
struct cons_iterator_identity;
template <typename Cons = nil>
struct cons_iterator : iterator_base<cons_iterator<Cons> >
{
typedef cons_iterator_tag fusion_tag;
typedef forward_traversal_tag category;
typedef Cons cons_type;
typedef cons_iterator_identity<
typename add_const<Cons>::type>
identity;
explicit cons_iterator(cons_type& cons)
: cons(cons) {}
cons_type& cons;
};
struct nil_iterator : iterator_base<nil_iterator>
{
typedef forward_traversal_tag category;
typedef cons_iterator_tag fusion_tag;
typedef nil cons_type;
typedef cons_iterator_identity<
add_const<nil>::type>
identity;
nil_iterator() {}
explicit nil_iterator(nil const&) {}
};
template <>
struct cons_iterator<nil> : nil_iterator
{
cons_iterator() {}
explicit cons_iterator(nil const&) {}
};
template <>
struct cons_iterator<nil const> : nil_iterator
{
cons_iterator() {}
explicit cons_iterator(nil const&) {}
};
template <>
struct cons_iterator<list<> > : nil_iterator
{
cons_iterator() {}
explicit cons_iterator(nil const&) {}
};
template <>
struct cons_iterator<list<> const> : nil_iterator
{
cons_iterator() {}
explicit cons_iterator(nil const&) {}
};
}}
#endif

View File

@ -0,0 +1,56 @@
/*=============================================================================
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_CONVERT_09232005_1215)
#define FUSION_CONVERT_09232005_1215
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/list/detail/build_cons.hpp>
#include <boost/fusion/container/list/detail/convert_impl.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence>
struct as_list
{
typedef typename
detail::build_cons<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
>
build_cons;
typedef typename build_cons::type type;
static type
call(Sequence& seq)
{
return build_cons::call(fusion::begin(seq), fusion::end(seq));
}
};
}
template <typename Sequence>
inline typename result_of::as_list<Sequence>::type
as_list(Sequence& seq)
{
return result_of::as_list<Sequence>::call(seq);
}
template <typename Sequence>
inline typename result_of::as_list<Sequence const>::type
as_list(Sequence const& seq)
{
return result_of::as_list<Sequence const>::call(seq);
}
}}
#endif

View File

@ -0,0 +1,79 @@
/*=============================================================================
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_IMPL_07172005_0726)
#define FUSION_AT_IMPL_07172005_0726
#include <boost/fusion/support/detail/access.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct cons_tag;
namespace extension
{
template <typename Tag>
struct at_impl;
template <>
struct at_impl<cons_tag>
{
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> >
>
element;
typedef typename
mpl::eval_if<
is_const<Sequence>
, detail::cref_result<element>
, detail::ref_result<element>
>::type
type;
template <typename Cons, int N2>
static type
call(Cons& s, mpl::int_<N2>)
{
return call(s.cdr, mpl::int_<N2-1>());
}
template <typename Cons>
static type
call(Cons& s, mpl::int_<0>)
{
return s.car;
}
static type
call(Sequence& s)
{
return call(s, mpl::int_<N::value>());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,49 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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_BEGIN_IMPL_07172005_0824)
#define FUSION_BEGIN_IMPL_07172005_0824
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion
{
struct nil;
struct cons_tag;
template <typename Car, typename Cdr>
struct cons;
template <typename Cons>
struct cons_iterator;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<cons_tag>
{
template <typename Sequence>
struct apply
{
typedef cons_iterator<Sequence> type;
static type
call(Sequence& t)
{
return type(t);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,57 @@
/*=============================================================================
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_BUILD_CONS_09232005_1222)
#define FUSION_BUILD_CONS_09232005_1222
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
namespace boost { namespace fusion { namespace detail
{
template <
typename First
, typename Last
, bool is_empty = result_of::equal_to<First, Last>::value>
struct build_cons;
template <typename First, typename Last>
struct build_cons<First, Last, true>
{
typedef nil type;
static nil
call(First const&, Last const&)
{
return nil();
}
};
template <typename First, typename Last>
struct build_cons<First, Last, false>
{
typedef
build_cons<typename result_of::next<First>::type, Last>
next_build_cons;
typedef cons<
typename result_of::value_of<First>::type
, typename next_build_cons::type>
type;
static type
call(First const& f, Last const& l)
{
return type(*f, next_build_cons::call(fusion::next(f), l));
}
};
}}}
#endif

View File

@ -0,0 +1,51 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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_CONVERT_IMPL_09232005_1215)
#define FUSION_CONVERT_IMPL_09232005_1215
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/list/detail/build_cons.hpp>
#include <boost/fusion/sequence/intrinsic/empty.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion
{
struct cons_tag;
namespace extension
{
template <typename T>
struct convert_impl;
template <>
struct convert_impl<cons_tag>
{
template <typename Sequence>
struct apply
{
typedef typename
detail::build_cons<
typename result_of::begin<Sequence>::type
, typename result_of::end<Sequence>::type
>
build_cons;
typedef typename build_cons::type type;
static type
call(Sequence& seq)
{
return build_cons::call(fusion::begin(seq), fusion::end(seq));
}
};
};
}
}}
#endif

View File

@ -0,0 +1,52 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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_DEREF_IMPL_07172005_0831)
#define FUSION_DEREF_IMPL_07172005_0831
#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
namespace boost { namespace fusion
{
struct cons_iterator_tag;
namespace extension
{
template <typename Tag>
struct deref_impl;
template <>
struct deref_impl<cons_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::cons_type cons_type;
typedef typename cons_type::car_type value_type;
typedef typename mpl::eval_if<
is_const<cons_type>
, add_reference<typename add_const<value_type>::type>
, add_reference<value_type> >::type
type;
static type
call(Iterator const& i)
{
return i.cons.car;
}
};
};
}
}}
#endif

View File

@ -0,0 +1,37 @@
/*=============================================================================
Copyright (c) 2007 Tobias Schwinger
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(BOOST_FUSION_SEQUENCE_EMPTY_IMPL_HPP_INCLUDED)
#define BOOST_FUSION_SEQUENCE_EMPTY_IMPL_HPP_INCLUDED
#include <boost/type_traits/is_convertible.hpp>
namespace boost { namespace fusion
{
struct cons_tag;
struct nil;
template <typename Car, typename Cdr>
struct cons;
namespace extension
{
template <typename Tag>
struct empty_impl;
template <>
struct empty_impl<cons_tag>
{
template <typename Sequence>
struct apply
: boost::is_convertible<Sequence, nil>
{};
};
}
}}
#endif

View File

@ -0,0 +1,51 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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_END_IMPL_07172005_0828)
#define FUSION_END_IMPL_07172005_0828
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion
{
struct nil;
struct cons_tag;
template <typename Car, typename Cdr>
struct cons;
template <typename Cons>
struct cons_iterator;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<cons_tag>
{
template <typename Sequence>
struct apply
{
typedef cons_iterator<
typename mpl::if_<is_const<Sequence>, nil const, nil>::type>
type;
static type
call(Sequence& t)
{
return type();
}
};
};
}
}}
#endif

View File

@ -0,0 +1,39 @@
/*=============================================================================
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_EQUAL_TO_IMPL_09172005_1120)
#define FUSION_EQUAL_TO_IMPL_09172005_1120
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/and.hpp>
namespace boost { namespace fusion
{
struct cons_iterator_tag;
namespace extension
{
template <typename Tag>
struct equal_to_impl;
template <>
struct equal_to_impl<cons_iterator_tag>
{
template <typename I1, typename I2>
struct apply
: is_same<
typename I1::identity
, typename I2::identity
>
{
};
};
}
}}
#endif

View File

@ -0,0 +1,47 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_LIST_FORWARD_CTOR_07172005_0113)
#define FUSION_LIST_FORWARD_CTOR_07172005_0113
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repetition/enum_shifted.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#define FUSION_LIST_CTOR_MAKE_CONS(z, n, type) tie_cons(BOOST_PP_CAT(_, n)
#define FUSION_LIST_CL_PAREN(z, n, type) )
#define BOOST_PP_FILENAME_1 \
<boost/fusion/container/list/detail/list_forward_ctor.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_LIST_SIZE)
#include BOOST_PP_ITERATE()
#undef FUSION_LIST_CTOR_MAKE_CONS
#undef FUSION_LIST_CL_PAREN
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
#if N == 1
explicit
#endif
list(BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type _))
: inherited_type(list_to_cons::call(BOOST_PP_ENUM_PARAMS(N, _)))
{}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,49 @@
/*=============================================================================
Copyright (c) 2005 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_LIST_TO_CONS_07172005_1041)
#define FUSION_LIST_TO_CONS_07172005_1041
#include <boost/fusion/container/list/cons.hpp>
#include <boost/fusion/container/list/limits.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>
#define FUSION_VOID(z, n, _) void_
namespace boost { namespace fusion
{
struct nil;
struct void_;
}}
namespace boost { namespace fusion { namespace detail
{
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename T)>
struct list_to_cons
{
typedef T0 head_type;
typedef list_to_cons<
BOOST_PP_ENUM_SHIFTED_PARAMS(FUSION_MAX_LIST_SIZE, T), void_>
tail_list_to_cons;
typedef typename tail_list_to_cons::type tail_type;
typedef cons<head_type, tail_type> type;
#include <boost/fusion/container/list/detail/list_to_cons_call.hpp>
};
template <>
struct list_to_cons<BOOST_PP_ENUM(FUSION_MAX_LIST_SIZE, FUSION_VOID, _)>
{
typedef nil type;
};
}}}
#undef FUSION_VOID
#endif

View File

@ -0,0 +1,43 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_LIST_TO_CONS_CALL_07192005_0138)
#define FUSION_LIST_TO_CONS_CALL_07192005_0138
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#define BOOST_PP_FILENAME_1 \
<boost/fusion/container/list/detail/list_to_cons_call.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_LIST_SIZE)
#include BOOST_PP_ITERATE()
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
static type
call(BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type _))
{
return type(_0
#if N > 1
, tail_list_to_cons::call(BOOST_PP_ENUM_SHIFTED_PARAMS(N, _)));
#else
);
#endif
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,59 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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_NEXT_IMPL_07172005_0836)
#define FUSION_NEXT_IMPL_07172005_0836
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
namespace boost { namespace fusion
{
struct cons_iterator_tag;
template <typename Cons>
struct cons_iterator;
namespace extension
{
template <typename Tag>
struct next_impl;
template <>
struct next_impl<cons_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::cons_type cons_type;
typedef typename cons_type::cdr_type cdr_type;
typedef cons_iterator<
typename mpl::eval_if<
is_const<cons_type>
, add_const<cdr_type>
, mpl::identity<cdr_type>
>::type>
type;
static type
call(Iterator const& i)
{
return type(i.cons.cdr);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,42 @@
/*=============================================================================
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_VALUE_AT_IMPL_07172005_0952)
#define FUSION_VALUE_AT_IMPL_07172005_0952
#include <boost/fusion/support/detail/access.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct cons_tag;
namespace extension
{
template <typename Tag>
struct value_at_impl;
template <>
struct value_at_impl<cons_tag>
{
template <typename Sequence, typename N>
struct apply
{
typedef typename
mpl::eval_if<
mpl::bool_<N::value == 0>
, mpl::identity<typename Sequence::car_type>
, apply<typename Sequence::cdr_type, mpl::int_<N::value-1> >
>::type
type;
};
};
}
}}
#endif

View File

@ -0,0 +1,36 @@
/*=============================================================================
Copyright (c) 2005 Joel de Guzman
Copyright (c) 2005 Eric Niebler
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_VALUE_OF_IMPL_07172005_0838)
#define FUSION_VALUE_OF_IMPL_07172005_0838
namespace boost { namespace fusion
{
struct cons_iterator_tag;
namespace extension
{
template <typename Tag>
struct value_of_impl;
template <>
struct value_of_impl<cons_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::cons_type cons_type;
typedef typename cons_type::car_type type;
};
};
}
}}
#endif

View File

@ -0,0 +1,19 @@
/*=============================================================================
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_LIST_LIMITS_07172005_0112)
#define FUSION_LIST_LIMITS_07172005_0112
#if !defined(FUSION_MAX_LIST_SIZE)
# define FUSION_MAX_LIST_SIZE 10
#else
# if FUSION_MAX_LIST_SIZE < 3
# undef FUSION_MAX_LIST_SIZE
# define FUSION_MAX_LIST_SIZE 10
# endif
#endif
#endif

View File

@ -0,0 +1,68 @@
/*=============================================================================
Copyright (c) 2005 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_LIST_07172005_1153)
#define FUSION_LIST_07172005_1153
#include <boost/fusion/container/list/list_fwd.hpp>
#include <boost/fusion/container/list/detail/list_to_cons.hpp>
namespace boost { namespace fusion
{
struct nil;
struct void_;
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename T)>
struct list
: detail::list_to_cons<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, T)>::type
{
private:
typedef
detail::list_to_cons<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, T)>
list_to_cons;
public:
typedef typename list_to_cons::type inherited_type;
list()
: inherited_type() {}
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename U)>
list(list<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, U)> const& rhs)
: inherited_type(rhs) {}
template <typename Sequence>
list(Sequence const& rhs)
: inherited_type(rhs) {}
// Expand a couple of forwarding constructors for arguments
// of type (T0), (T0, T1), (T0, T1, T2) etc. Exanple:
//
// list(
// typename detail::call_param<T0>::type _0
// , typename detail::call_param<T1>::type _1)
// : inherited_type(list_to_cons::call(_0, _1)) {}
#include <boost/fusion/container/list/detail/list_forward_ctor.hpp>
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, typename U)>
list&
operator=(list<BOOST_PP_ENUM_PARAMS(FUSION_MAX_LIST_SIZE, U)> const& rhs)
{
inherited_type::operator=(rhs);
return *this;
}
template <typename T>
list&
operator=(T const& rhs)
{
inherited_type::operator=(rhs);
return *this;
}
};
}}
#endif

View File

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2005 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_LIST_FORWARD_07172005_0224)
#define FUSION_LIST_FORWARD_07172005_0224
#include <boost/fusion/container/list/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
namespace boost { namespace fusion
{
struct void_;
template <
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
FUSION_MAX_LIST_SIZE, typename T, void_)
>
struct list;
}}
#endif

View File

@ -0,0 +1,15 @@
/*=============================================================================
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_SEQUENCE_CLASS_MAP_10022005_0606)
#define FUSION_SEQUENCE_CLASS_MAP_10022005_0606
#include <boost/fusion/container/map/limits.hpp>
#include <boost/fusion/container/map/map.hpp>
#include <boost/fusion/container/map/map_fwd.hpp>
#include <boost/fusion/container/map/convert.hpp>
#endif

View File

@ -0,0 +1,47 @@
/*=============================================================================
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_CONVERT_09232005_1340)
#define FUSION_CONVERT_09232005_1340
#include <boost/fusion/container/map/detail/as_map.hpp>
#include <boost/fusion/container/map/detail/convert_impl.hpp>
#include <boost/fusion/container/map/map.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence>
struct as_map
{
typedef typename detail::as_map<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
};
}
template <typename Sequence>
inline typename result_of::as_map<Sequence>::type
as_map(Sequence& seq)
{
typedef typename result_of::as_map<Sequence>::gen gen;
return gen::call(fusion::begin(seq));
}
template <typename Sequence>
inline typename result_of::as_map<Sequence const>::type
as_map(Sequence const& seq)
{
typedef typename result_of::as_map<Sequence const>::gen gen;
return gen::call(fusion::begin(seq));
}
}}
#endif

View File

@ -0,0 +1,101 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_AS_MAP_0932005_1339)
#define FUSION_AS_MAP_0932005_1339
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/inc.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/fusion/container/map/map.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
namespace boost { namespace fusion { namespace detail
{
template <int size>
struct as_map;
template <>
struct as_map<0>
{
template <typename Iterator>
struct apply
{
typedef map<> type;
};
template <typename Iterator>
static typename apply<Iterator>::type
call(Iterator)
{
return map<>();
}
};
#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
BOOST_PP_CAT(I, BOOST_PP_INC(n));
#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
BOOST_PP_CAT(T, n);
#define BOOST_PP_FILENAME_1 <boost/fusion/container/map/detail/as_map.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE)
#include BOOST_PP_ITERATE()
#undef BOOST_FUSION_NEXT_ITERATOR
#undef BOOST_FUSION_NEXT_CALL_ITERATOR
#undef BOOST_FUSION_VALUE_OF_ITERATOR
}}}
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
template <>
struct as_map<N>
{
template <typename I0>
struct apply
{
BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
typedef map<BOOST_PP_ENUM_PARAMS(N, T)> type;
};
template <typename Iterator>
static typename apply<Iterator>::type
call(Iterator const& i0)
{
typedef apply<Iterator> gen;
typedef typename gen::type result;
BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
return result(BOOST_PP_ENUM_PARAMS(N, *i));
}
};
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,49 @@
/*=============================================================================
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_KEY_IMPL_05222005_0254)
#define FUSION_AT_KEY_IMPL_05222005_0254
#include <boost/fusion/support/detail/access.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace fusion
{
struct map_tag;
namespace extension
{
template <typename Tag>
struct at_key_impl;
template <>
struct at_key_impl<map_tag>
{
template <typename Sequence, typename Key>
struct apply
{
typedef typename Sequence::template meta_at_impl<Key> element;
typedef typename
mpl::eval_if<
is_const<Sequence>
, detail::cref_result<element>
, detail::ref_result<element>
>::type
type;
static type
call(Sequence& m)
{
return m.at_impl(mpl::identity<Key>());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,56 @@
/*=============================================================================
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_BEGIN_IMPL_05222005_1108)
#define FUSION_BEGIN_IMPL_05222005_1108
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace fusion
{
struct map_tag;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<map_tag>
{
template <typename Sequence>
struct apply
{
typedef typename
result_of::begin<typename Sequence::storage_type>::type
iterator_type;
typedef typename
result_of::begin<typename Sequence::storage_type const>::type
const_iterator_type;
typedef typename
mpl::eval_if<
is_const<Sequence>
, mpl::identity<const_iterator_type>
, mpl::identity<iterator_type>
>::type
type;
static type
call(Sequence& m)
{
return fusion::begin(m.get_data());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,45 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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_CONVERT_IMPL_09232005_1340)
#define FUSION_CONVERT_IMPL_09232005_1340
#include <boost/fusion/container/map/detail/as_map.hpp>
#include <boost/fusion/container/map/map.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
namespace boost { namespace fusion
{
struct map_tag;
namespace extension
{
template <typename T>
struct convert_impl;
template <>
struct convert_impl<map_tag>
{
template <typename Sequence>
struct apply
{
typedef typename detail::as_map<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
static type call(Sequence& seq)
{
return gen::call(fusion::begin(seq));
}
};
};
}
}}
#endif

View File

@ -0,0 +1,53 @@
/*=============================================================================
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_END_IMPL_05222005_1108)
#define FUSION_END_IMPL_05222005_1108
#include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion
{
struct map_tag;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<map_tag>
{
template <typename Sequence>
struct apply
{
typedef typename
result_of::end<typename Sequence::storage_type>::type
iterator_type;
typedef typename
result_of::end<typename Sequence::storage_type const>::type
const_iterator_type;
typedef typename
mpl::eval_if<
is_const<Sequence>
, mpl::identity<const_iterator_type>
, mpl::identity<iterator_type>
>::type
type;
static type
call(Sequence& m)
{
return fusion::end(m.get_data());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,99 @@
/*=============================================================================
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_LOOKUP_KEY_07222005_1248)
#define FUSION_LOOKUP_KEY_07222005_1248
#include <boost/mpl/int.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/fusion/support/detail/unknown_key.hpp>
namespace boost { namespace fusion
{
struct void_;
}}
namespace boost { namespace fusion { namespace detail
{
template <typename T>
struct map_data_type
{
typedef typename
add_reference<
typename T::second_type
>::type
type;
};
template <>
struct map_data_type<void_>
{
typedef void_& type;
};
template <typename T>
struct map_const_data_type
{
typedef typename
add_reference<
typename add_const<
typename T::second_type
>::type
>::type
type;
};
template <>
struct map_const_data_type<void_>
{
typedef void_ const& type;
};
template <typename T>
struct map_value_type
{
typedef typename T::second_type type;
};
template <>
struct map_value_type<void_>
{
typedef void_ type;
};
template <typename T, int index>
struct map_key_type
{
typedef typename T::first_type type;
};
template <int index>
struct map_key_type<void_, index>
{
typedef unknown_key<index> type;
};
template <int index, typename RT, typename Key, typename Vector>
struct map_lookup_key
{
static RT
call(Vector& vec)
{
return vec.at_impl(mpl::int_<index>()).second;
}
};
template <int index, typename Vector>
struct map_lookup_key<index, void_&, unknown_key<index>, Vector>
{
static void_&
call(Vector& vec); // intentionally undefined
};
}}}
#endif

View File

@ -0,0 +1,38 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_MAP_FORWARD_CTOR_07222005_0106)
#define FUSION_MAP_FORWARD_CTOR_07222005_0106
#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/container/map/detail/map_forward_ctor.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE)
#include BOOST_PP_ITERATE()
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
#if N == 1
explicit
#endif
map(BOOST_PP_ENUM_BINARY_PARAMS(N, T, const& _))
: data(BOOST_PP_ENUM_PARAMS(N, _)) {}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,128 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_MAP_LOOKUP_07212005_1118)
#define FUSION_MAP_LOOKUP_07212005_1118
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
#pragma warning (push)
#pragma warning(disable: 4348) // redefinition of default parameter
#endif
template <typename Key, typename dummy = int>
struct meta_at_impl
{
typedef void_ type;
};
template <typename Key, typename dummy = int>
struct meta_find_impl
{
typedef vector_iterator<storage_type, storage_type::size::value> type;
};
template <typename Key, typename dummy = int>
struct meta_find_impl_const
{
typedef vector_iterator<storage_type const, storage_type::size::value> type;
};
template <typename Key>
vector_iterator<storage_type const, storage_type::size::value>
find_impl(mpl::identity<Key>) const
{
return vector_iterator<storage_type const, storage_type::size::value>(data);
}
template <typename Key>
vector_iterator<storage_type, storage_type::size::value>
find_impl(mpl::identity<Key>)
{
return vector_iterator<storage_type, storage_type::size::value>(data);
}
#define BOOST_PP_FILENAME_1 \
<boost/fusion/container/map/detail/map_lookup.hpp>
#define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_DEC(FUSION_MAX_MAP_SIZE))
#include BOOST_PP_ITERATE()
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
#pragma warning (pop)
#endif
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
template <typename dummy>
struct meta_at_impl<
typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
{
typedef typename detail::map_value_type<BOOST_PP_CAT(T, N)>::type type;
};
typename detail::map_data_type<BOOST_PP_CAT(T, N)>::type
at_impl(mpl::identity<typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type>)
{
return detail::map_lookup_key<
N
, typename detail::map_data_type<BOOST_PP_CAT(T, N)>::type
, typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type
, storage_type>::call(data);
}
typename detail::map_const_data_type<BOOST_PP_CAT(T, N)>::type
at_impl(mpl::identity<typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type>) const
{
return detail::map_lookup_key<
N
, typename detail::map_const_data_type<BOOST_PP_CAT(T, N)>::type
, typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type
, storage_type const>::call(data);
}
template <typename dummy>
struct meta_find_impl<
typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
{
typedef vector_iterator<storage_type, N> type;
};
template <typename dummy>
struct meta_find_impl_const<
typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
{
typedef vector_iterator<storage_type const, N> type;
};
vector_iterator<storage_type, N>
find_impl(mpl::identity<typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type>)
{
return vector_iterator<storage_type, N>(data);
}
vector_iterator<storage_type const, N>
find_impl(mpl::identity<typename detail::map_key_type<BOOST_PP_CAT(T, N), N>::type>) const
{
return vector_iterator<storage_type const, N>(data);
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,33 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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_VALUE_AT_KEY_IMPL_05222005_0325)
#define FUSION_VALUE_AT_KEY_IMPL_05222005_0325
namespace boost { namespace fusion
{
struct map_tag;
namespace extension
{
template <typename Tag>
struct value_at_key_impl;
template <>
struct value_at_key_impl<map_tag>
{
template <typename Sequence, typename Key>
struct apply
{
typedef typename Sequence::
template meta_at_impl<Key>::type type;
};
};
}
}}
#endif

View File

@ -0,0 +1,25 @@
/*=============================================================================
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_MAP_LIMITS_07212005_1104)
#define FUSION_MAP_LIMITS_07212005_1104
#include <boost/fusion/container/vector/limits.hpp>
#if !defined(FUSION_MAX_MAP_SIZE)
# define FUSION_MAX_MAP_SIZE FUSION_MAX_VECTOR_SIZE
#else
# if FUSION_MAX_MAP_SIZE < 3
# undef FUSION_MAX_MAP_SIZE
# if (FUSION_MAX_VECTOR_SIZE > 10)
# define FUSION_MAX_MAP_SIZE 10
# else
# define FUSION_MAX_MAP_SIZE FUSION_MAX_VECTOR_SIZE
# endif
# endif
#endif
#endif

View File

@ -0,0 +1,71 @@
/*=============================================================================
Copyright (c) 2005 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_MAP_07212005_1106)
#define FUSION_MAP_07212005_1106
#include <boost/fusion/support/pair.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/container/map/map_fwd.hpp>
#include <boost/fusion/container/map/detail/lookup_key.hpp>
#include <boost/fusion/container/map/detail/begin_impl.hpp>
#include <boost/fusion/container/map/detail/end_impl.hpp>
#include <boost/fusion/container/map/detail/at_key_impl.hpp>
#include <boost/fusion/container/map/detail/value_at_key_impl.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct void_;
struct map_tag;
struct fusion_sequence_tag;
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, typename T)>
struct map : sequence_base<map<BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)> >
{
struct category : forward_traversal_tag, associative_sequence_tag {};
typedef map_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef vector<
BOOST_PP_ENUM_PARAMS(FUSION_MAX_MAP_SIZE, T)>
storage_type;
typedef typename storage_type::size size;
map()
: data() {}
template <typename Sequence>
map(Sequence const& rhs)
: data(rhs) {}
#include <boost/fusion/container/map/detail/map_forward_ctor.hpp>
#include <boost/fusion/container/map/detail/map_lookup.hpp>
template <typename T>
map&
operator=(T const& rhs)
{
data = rhs;
return *this;
}
storage_type& get_data() { return data; }
storage_type const& get_data() const { return data; }
private:
storage_type data;
};
}}
#endif

View File

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2005 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_MAP_FORWARD_07212005_1105)
#define FUSION_MAP_FORWARD_07212005_1105
#include <boost/fusion/container/map/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
namespace boost { namespace fusion
{
struct void_;
template <
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
FUSION_MAX_MAP_SIZE, typename T, void_)
>
struct map;
}}
#endif

View File

@ -0,0 +1,15 @@
/*=============================================================================
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_SEQUENCE_CLASS_SET_10022005_0607)
#define FUSION_SEQUENCE_CLASS_SET_10022005_0607
#include <boost/fusion/container/set/limits.hpp>
#include <boost/fusion/container/set/set.hpp>
#include <boost/fusion/container/set/set_fwd.hpp>
#include <boost/fusion/container/set/convert.hpp>
#endif

View File

@ -0,0 +1,47 @@
/*=============================================================================
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_CONVERT_09232005_1341)
#define FUSION_CONVERT_09232005_1341
#include <boost/fusion/container/set/detail/as_set.hpp>
#include <boost/fusion/container/set/detail/convert_impl.hpp>
#include <boost/fusion/container/set/set.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence>
struct as_set
{
typedef typename detail::as_set<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
};
}
template <typename Sequence>
inline typename result_of::as_set<Sequence>::type
as_set(Sequence& seq)
{
typedef typename result_of::as_set<Sequence>::gen gen;
return gen::call(fusion::begin(seq));
}
template <typename Sequence>
inline typename result_of::as_set<Sequence const>::type
as_set(Sequence const& seq)
{
typedef typename result_of::as_set<Sequence const>::gen gen;
return gen::call(fusion::begin(seq));
}
}}
#endif

View File

@ -0,0 +1,101 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_AS_SET_0932005_1341)
#define FUSION_AS_SET_0932005_1341
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/inc.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/fusion/container/set/set.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
namespace boost { namespace fusion { namespace detail
{
template <int size>
struct as_set;
template <>
struct as_set<0>
{
template <typename Iterator>
struct apply
{
typedef set<> type;
};
template <typename Iterator>
static typename apply<Iterator>::type
call(Iterator)
{
return set<>();
}
};
#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
BOOST_PP_CAT(I, BOOST_PP_INC(n));
#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
BOOST_PP_CAT(T, n);
#define BOOST_PP_FILENAME_1 <boost/fusion/container/set/detail/as_set.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_SET_SIZE)
#include BOOST_PP_ITERATE()
#undef BOOST_FUSION_NEXT_ITERATOR
#undef BOOST_FUSION_NEXT_CALL_ITERATOR
#undef BOOST_FUSION_VALUE_OF_ITERATOR
}}}
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
template <>
struct as_set<N>
{
template <typename I0>
struct apply
{
BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
typedef set<BOOST_PP_ENUM_PARAMS(N, T)> type;
};
template <typename Iterator>
static typename apply<Iterator>::type
call(Iterator const& i0)
{
typedef apply<Iterator> gen;
typedef typename gen::type result;
BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
return result(BOOST_PP_ENUM_PARAMS(N, *i));
}
};
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,49 @@
/*=============================================================================
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_KEY_IMPL_09162005_1118)
#define FUSION_AT_KEY_IMPL_09162005_1118
#include <boost/fusion/support/detail/access.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace fusion
{
struct set_tag;
namespace extension
{
template <typename Tag>
struct at_key_impl;
template <>
struct at_key_impl<set_tag>
{
template <typename Sequence, typename Key>
struct apply
{
typedef typename Sequence::template meta_at_impl<Key> element;
typedef typename
mpl::eval_if<
is_const<Sequence>
, detail::cref_result<element>
, detail::ref_result<element>
>::type
type;
static type
call(Sequence& s)
{
return s.at_impl(mpl::identity<Key>());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,56 @@
/*=============================================================================
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_BEGIN_IMPL_09162005_1120)
#define FUSION_BEGIN_IMPL_09162005_1120
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/identity.hpp>
namespace boost { namespace fusion
{
struct set_tag;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<set_tag>
{
template <typename Sequence>
struct apply
{
typedef typename
result_of::begin<typename Sequence::storage_type>::type
iterator_type;
typedef typename
result_of::begin<typename Sequence::storage_type const>::type
const_iterator_type;
typedef typename
mpl::eval_if<
is_const<Sequence>
, mpl::identity<const_iterator_type>
, mpl::identity<iterator_type>
>::type
type;
static type
call(Sequence& s)
{
return fusion::begin(s.get_data());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,45 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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_CONVERT_IMPL_09232005_1341)
#define FUSION_CONVERT_IMPL_09232005_1341
#include <boost/fusion/container/set/detail/as_set.hpp>
#include <boost/fusion/container/set/set.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
namespace boost { namespace fusion
{
struct set_tag;
namespace extension
{
template <typename T>
struct convert_impl;
template <>
struct convert_impl<set_tag>
{
template <typename Sequence>
struct apply
{
typedef typename detail::as_set<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
static type call(Sequence& seq)
{
return gen::call(fusion::begin(seq));
}
};
};
}
}}
#endif

View File

@ -0,0 +1,53 @@
/*=============================================================================
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_END_IMPL_09162005_1121)
#define FUSION_END_IMPL_09162005_1121
#include <boost/fusion/sequence/intrinsic/end.hpp>
namespace boost { namespace fusion
{
struct set_tag;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<set_tag>
{
template <typename Sequence>
struct apply
{
typedef typename
result_of::end<typename Sequence::storage_type>::type
iterator_type;
typedef typename
result_of::end<typename Sequence::storage_type const>::type
const_iterator_type;
typedef typename
mpl::eval_if<
is_const<Sequence>
, mpl::identity<const_iterator_type>
, mpl::identity<iterator_type>
>::type
type;
static type
call(Sequence& s)
{
return fusion::end(s.get_data());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,93 @@
/*=============================================================================
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_LOOKUP_KEY_09162005_1111)
#define FUSION_LOOKUP_KEY_09162005_1111
#include <boost/mpl/int.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/fusion/support/detail/unknown_key.hpp>
namespace boost { namespace fusion
{
struct void_;
}}
namespace boost { namespace fusion { namespace detail
{
template <typename T>
struct set_data_type
{
typedef typename add_reference<T>::type type;
};
template <>
struct set_data_type<void_>
{
typedef void_& type;
};
template <typename T>
struct set_const_data_type
{
typedef typename
add_reference<
typename add_const<T>::type
>::type
type;
};
template <>
struct set_const_data_type<void_>
{
typedef void_ const& type;
};
template <typename T>
struct set_value_type
{
typedef T type;
};
template <>
struct set_value_type<void_>
{
typedef void_ type;
};
template <typename T, int index>
struct set_key_type
{
typedef T type;
};
template <int index>
struct set_key_type<void_, index>
{
typedef unknown_key<index> type;
};
template <int index, typename RT, typename Key, typename Vector>
struct set_lookup_key
{
static RT
call(Vector& vec)
{
return vec.at_impl(mpl::int_<index>());
}
};
template <int index, typename Vector>
struct set_lookup_key<index, void_&, unknown_key<index>, Vector>
{
static void_&
call(Vector& vec); // intentionally undefined
};
}}}
#endif

View File

@ -0,0 +1,39 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_SET_FORWARD_CTOR_09162005_1115)
#define FUSION_SET_FORWARD_CTOR_09162005_1115
#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/container/set/detail/set_forward_ctor.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_SET_SIZE)
#include BOOST_PP_ITERATE()
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
#if N == 1
explicit
#endif
set(BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type _))
: data(BOOST_PP_ENUM_PARAMS(N, _)) {}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,128 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_SET_LOOKUP_09162005_1116)
#define FUSION_SET_LOOKUP_09162005_1116
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/arithmetic/dec.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
#pragma warning (push)
#pragma warning(disable: 4348) // redefinition of default parameter
#endif
template <typename Key, typename dummy = int>
struct meta_at_impl
{
typedef void_ type;
};
template <typename Key, typename dummy = int>
struct meta_find_impl
{
typedef vector_iterator<storage_type, storage_type::size::value> type;
};
template <typename Key, typename dummy = int>
struct meta_find_impl_const
{
typedef vector_iterator<storage_type const, storage_type::size::value> type;
};
template <typename Key>
vector_iterator<storage_type const, storage_type::size::value>
find_impl(mpl::identity<Key>) const
{
return vector_iterator<storage_type const, storage_type::size::value>(data);
}
template <typename Key>
vector_iterator<storage_type, storage_type::size::value>
find_impl(mpl::identity<Key>)
{
return vector_iterator<storage_type, storage_type::size::value>(data);
}
#define BOOST_PP_FILENAME_1 \
<boost/fusion/container/set/detail/set_lookup.hpp>
#define BOOST_PP_ITERATION_LIMITS (0, BOOST_PP_DEC(FUSION_MAX_SET_SIZE))
#include BOOST_PP_ITERATE()
#if defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
#pragma warning (pop)
#endif
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
template <typename dummy>
struct meta_at_impl<
typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
{
typedef typename detail::set_value_type<BOOST_PP_CAT(T, N)>::type type;
};
typename detail::set_data_type<BOOST_PP_CAT(T, N)>::type
at_impl(mpl::identity<typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type>)
{
return detail::set_lookup_key<
N
, typename detail::set_data_type<BOOST_PP_CAT(T, N)>::type
, typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type
, storage_type>::call(data);
}
typename detail::set_const_data_type<BOOST_PP_CAT(T, N)>::type
at_impl(mpl::identity<typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type>) const
{
return detail::set_lookup_key<
N
, typename detail::set_const_data_type<BOOST_PP_CAT(T, N)>::type
, typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type
, storage_type const>::call(data);
}
template <typename dummy>
struct meta_find_impl<
typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
{
typedef vector_iterator<storage_type, N> type;
};
template <typename dummy>
struct meta_find_impl_const<
typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type, dummy>
{
typedef vector_iterator<storage_type const, N> type;
};
vector_iterator<storage_type, N>
find_impl(mpl::identity<typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type>)
{
return vector_iterator<storage_type, N>(data);
}
vector_iterator<storage_type const, N>
find_impl(mpl::identity<typename detail::set_key_type<BOOST_PP_CAT(T, N), N>::type>) const
{
return vector_iterator<storage_type const, N>(data);
}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,35 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2006 Dan Marsden
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_VALUE_AT_KEY_IMPL_09162005_1123)
#define FUSION_VALUE_AT_KEY_IMPL_09162005_1123
#include <boost/mpl/at.hpp>
namespace boost { namespace fusion
{
struct set_tag;
namespace extension
{
template <typename Tag>
struct value_at_key_impl;
template <>
struct value_at_key_impl<set_tag>
{
template <typename Sequence, typename Key>
struct apply
{
typedef typename Sequence::
template meta_at_impl<Key>::type type;
};
};
}
}}
#endif

View File

@ -0,0 +1,25 @@
/*=============================================================================
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_SET_LIMITS_09162005_1103)
#define FUSION_SET_LIMITS_09162005_1103
#include <boost/fusion/container/vector/limits.hpp>
#if !defined(FUSION_MAX_SET_SIZE)
# define FUSION_MAX_SET_SIZE FUSION_MAX_VECTOR_SIZE
#else
# if FUSION_MAX_SET_SIZE < 3
# undef FUSION_MAX_SET_SIZE
# if (FUSION_MAX_VECTOR_SIZE > 10)
# define FUSION_MAX_SET_SIZE 10
# else
# define FUSION_MAX_SET_SIZE FUSION_MAX_VECTOR_SIZE
# endif
# endif
#endif
#endif

View File

@ -0,0 +1,71 @@
/*=============================================================================
Copyright (c) 2005 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_SET_09162005_1104)
#define FUSION_SET_09162005_1104
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/container/set/set_fwd.hpp>
#include <boost/fusion/container/set/detail/lookup_key.hpp>
#include <boost/fusion/container/set/detail/begin_impl.hpp>
#include <boost/fusion/container/set/detail/end_impl.hpp>
#include <boost/fusion/container/set/detail/at_key_impl.hpp>
#include <boost/fusion/container/set/detail/value_at_key_impl.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/bool.hpp>
namespace boost { namespace fusion
{
struct void_;
struct set_tag;
struct fusion_sequence_tag;
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_SET_SIZE, typename T)>
struct set : sequence_base<set<BOOST_PP_ENUM_PARAMS(FUSION_MAX_SET_SIZE, T)> >
{
struct category : forward_traversal_tag, associative_sequence_tag {};
typedef set_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef vector<
BOOST_PP_ENUM_PARAMS(FUSION_MAX_SET_SIZE, T)>
storage_type;
typedef typename storage_type::size size;
set()
: data() {}
template <typename Sequence>
set(Sequence const& rhs)
: data(rhs) {}
#include <boost/fusion/container/set/detail/set_forward_ctor.hpp>
#include <boost/fusion/container/set/detail/set_lookup.hpp>
template <typename T>
set&
operator=(T const& rhs)
{
data = rhs;
return *this;
}
storage_type& get_data() { return data; }
storage_type const& get_data() const { return data; }
private:
storage_type data;
};
}}
#endif

View File

@ -0,0 +1,24 @@
/*=============================================================================
Copyright (c) 2005 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_SET_FORWARD_09162005_1102)
#define FUSION_SET_FORWARD_09162005_1102
#include <boost/fusion/container/set/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
namespace boost { namespace fusion
{
struct void_;
template <
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
FUSION_MAX_SET_SIZE, typename T, void_)
>
struct set;
}}
#endif

View File

@ -0,0 +1,21 @@
/*=============================================================================
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_SEQUENCE_CLASS_VECTOR_10022005_0602)
#define FUSION_SEQUENCE_CLASS_VECTOR_10022005_0602
#include <boost/fusion/container/vector/limits.hpp>
#include <boost/fusion/container/vector/vector10.hpp>
#include <boost/fusion/container/vector/vector20.hpp>
#include <boost/fusion/container/vector/vector30.hpp>
#include <boost/fusion/container/vector/vector40.hpp>
#include <boost/fusion/container/vector/vector50.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/vector_iterator.hpp>
#include <boost/fusion/container/vector/convert.hpp>
#endif

View File

@ -0,0 +1,47 @@
/*=============================================================================
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_CONVERT_09222005_1104)
#define FUSION_CONVERT_09222005_1104
#include <boost/fusion/container/vector/detail/as_vector.hpp>
#include <boost/fusion/container/vector/detail/convert_impl.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
namespace boost { namespace fusion
{
namespace result_of
{
template <typename Sequence>
struct as_vector
{
typedef typename detail::as_vector<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
};
}
template <typename Sequence>
inline typename result_of::as_vector<Sequence>::type
as_vector(Sequence& seq)
{
typedef typename result_of::as_vector<Sequence>::gen gen;
return gen::call(fusion::begin(seq));
}
template <typename Sequence>
inline typename result_of::as_vector<Sequence const>::type
as_vector(Sequence const& seq)
{
typedef typename result_of::as_vector<Sequence const>::gen gen;
return gen::call(fusion::begin(seq));
}
}}
#endif

View File

@ -0,0 +1,42 @@
/*=============================================================================
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_ADVANCE_IMPL_09172005_1156)
#define FUSION_ADVANCE_IMPL_09172005_1156
namespace boost { namespace fusion
{
struct vector_iterator_tag;
template <typename Vector, int N>
struct vector_iterator;
namespace extension
{
template <typename Tag>
struct advance_impl;
template <>
struct advance_impl<vector_iterator_tag>
{
template <typename Iterator, typename N>
struct apply
{
typedef typename Iterator::index index;
typedef typename Iterator::vector vector;
typedef vector_iterator<vector, index::value+N::value> type;
static type
call(Iterator const& i)
{
return type(i.vec);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,101 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_AS_VECTOR_09222005_0950)
#define FUSION_AS_VECTOR_09222005_0950
#include <boost/preprocessor/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/inc.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/iterator/next.hpp>
namespace boost { namespace fusion { namespace detail
{
template <int size>
struct as_vector;
template <>
struct as_vector<0>
{
template <typename Iterator>
struct apply
{
typedef vector<> type;
};
template <typename Iterator>
static typename apply<Iterator>::type
call(Iterator)
{
return vector<>();
}
};
#define BOOST_FUSION_NEXT_ITERATOR(z, n, data) \
typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type \
BOOST_PP_CAT(I, BOOST_PP_INC(n));
#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data) \
typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n)) \
BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data) \
typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type \
BOOST_PP_CAT(T, n);
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/detail/as_vector.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
#include BOOST_PP_ITERATE()
#undef BOOST_FUSION_NEXT_ITERATOR
#undef BOOST_FUSION_NEXT_CALL_ITERATOR
#undef BOOST_FUSION_VALUE_OF_ITERATOR
}}}
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
template <>
struct as_vector<N>
{
template <typename I0>
struct apply
{
BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
typedef vector<BOOST_PP_ENUM_PARAMS(N, T)> type;
};
template <typename Iterator>
static typename apply<Iterator>::type
call(Iterator const& i0)
{
typedef apply<Iterator> gen;
typedef typename gen::type result;
BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
return result(BOOST_PP_ENUM_PARAMS(N, *i));
}
};
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,49 @@
/*=============================================================================
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_IMPL_05042005_0741)
#define FUSION_AT_IMPL_05042005_0741
#include <boost/fusion/support/detail/access.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/int.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
namespace extension
{
template <typename Tag>
struct at_impl;
template <>
struct at_impl<vector_tag>
{
template <typename Sequence, typename N>
struct apply
{
typedef mpl::at<typename Sequence::types, N> element;
typedef typename
mpl::eval_if<
is_const<Sequence>
, detail::cref_result<element>
, detail::ref_result<element>
>::type
type;
static type
call(Sequence& v)
{
return v.at_impl(N());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,39 @@
/*=============================================================================
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_BEGIN_IMPL_05042005_1136)
#define FUSION_BEGIN_IMPL_05042005_1136
#include <boost/fusion/container/vector/vector_iterator.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
namespace extension
{
template <typename Tag>
struct begin_impl;
template <>
struct begin_impl<vector_tag>
{
template <typename Sequence>
struct apply
{
typedef vector_iterator<Sequence, 0> type;
static type
call(Sequence& v)
{
return type(v);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,45 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
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_CONVERT_IMPL_09222005_1104)
#define FUSION_CONVERT_IMPL_09222005_1104
#include <boost/fusion/container/vector/detail/as_vector.hpp>
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
namespace extension
{
template <typename T>
struct convert_impl;
template <>
struct convert_impl<vector_tag>
{
template <typename Sequence>
struct apply
{
typedef typename detail::as_vector<result_of::size<Sequence>::value> gen;
typedef typename gen::
template apply<typename result_of::begin<Sequence>::type>::type
type;
static type call(Sequence& seq)
{
return gen::call(fusion::begin(seq));
}
};
};
}
}}
#endif

View File

@ -0,0 +1,53 @@
/*=============================================================================
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_DEREF_IMPL_05042005_1037)
#define FUSION_DEREF_IMPL_05042005_1037
#include <boost/mpl/at.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace fusion
{
struct vector_iterator_tag;
namespace extension
{
template <typename Tag>
struct deref_impl;
template <>
struct deref_impl<vector_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::vector vector;
typedef typename Iterator::index index;
typedef typename mpl::at<
typename vector::types, index>
element;
typedef typename
mpl::eval_if<
is_const<vector>
, fusion::detail::cref_result<element>
, fusion::detail::ref_result<element>
>::type
type;
static type
call(Iterator const& i)
{
return i.vec.at_impl(index());
}
};
};
}
}}
#endif

View File

@ -0,0 +1,41 @@
/*=============================================================================
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_DISTANCE_IMPL_09172005_0751)
#define FUSION_DISTANCE_IMPL_09172005_0751
#include <boost/mpl/minus.hpp>
namespace boost { namespace fusion
{
struct vector_iterator_tag;
namespace extension
{
template <typename Tag>
struct distance_impl;
template <>
struct distance_impl<vector_iterator_tag>
{
template <typename First, typename Last>
struct apply : mpl::minus<typename Last::index, typename First::index>
{
static typename mpl::minus<
typename Last::index, typename First::index>::type
call(First const&, Last const&)
{
typedef typename mpl::minus<
typename Last::index, typename First::index>::type
result;
return result();
}
};
};
}
}}
#endif

View File

@ -0,0 +1,40 @@
/*=============================================================================
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_END_IMPL_05042005_1142)
#define FUSION_END_IMPL_05042005_1142
#include <boost/fusion/container/vector/vector_iterator.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
namespace extension
{
template <typename Tag>
struct end_impl;
template <>
struct end_impl<vector_tag>
{
template <typename Sequence>
struct apply
{
typedef typename Sequence::size size;
typedef vector_iterator<Sequence, size::value> type;
static type
call(Sequence& v)
{
return type(v);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,39 @@
/*=============================================================================
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_EQUAL_TO_IMPL_05052005_1215)
#define FUSION_EQUAL_TO_IMPL_05052005_1215
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/and.hpp>
namespace boost { namespace fusion
{
struct vector_iterator_tag;
namespace extension
{
template <typename Tag>
struct equal_to_impl;
template <>
struct equal_to_impl<vector_iterator_tag>
{
template <typename I1, typename I2>
struct apply
: is_same<
typename I1::identity
, typename I2::identity
>
{
};
};
}
}}
#endif

View File

@ -0,0 +1,43 @@
/*=============================================================================
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_NEXT_IMPL_05042005_1058)
#define FUSION_NEXT_IMPL_05042005_1058
#include <boost/fusion/container/vector/vector_iterator.hpp>
namespace boost { namespace fusion
{
struct vector_iterator_tag;
template <typename Vector, int N>
struct vector_iterator;
namespace extension
{
template <typename Tag>
struct next_impl;
template <>
struct next_impl<vector_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::vector vector;
typedef typename Iterator::index index;
typedef vector_iterator<vector, index::value+1> type;
static type
call(Iterator const& i)
{
return type(i.vec);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,43 @@
/*=============================================================================
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_PRIOR_IMPL_05042005_1145)
#define FUSION_PRIOR_IMPL_05042005_1145
#include <boost/fusion/container/vector/vector_iterator.hpp>
namespace boost { namespace fusion
{
struct vector_iterator_tag;
template <typename Vector, int N>
struct vector_iterator;
namespace extension
{
template <typename Tag>
struct prior_impl;
template <>
struct prior_impl<vector_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::vector vector;
typedef typename Iterator::index index;
typedef vector_iterator<vector, index::value-1> type;
static type
call(Iterator const& i)
{
return type(i.vec);
}
};
};
}
}}
#endif

View File

@ -0,0 +1,33 @@
/*=============================================================================
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_VALUE_AT_IMPL_05052005_0232)
#define FUSION_VALUE_AT_IMPL_05052005_0232
#include <boost/mpl/at.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
namespace extension
{
template <typename Tag>
struct value_at_impl;
template <>
struct value_at_impl<vector_tag>
{
template <typename Sequence, typename N>
struct apply
{
typedef typename mpl::at<typename Sequence::types, N>::type type;
};
};
}
}}
#endif

View File

@ -0,0 +1,37 @@
/*=============================================================================
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_VALUE_OF_IMPL_05052005_1128)
#define FUSION_VALUE_OF_IMPL_05052005_1128
#include <boost/mpl/at.hpp>
namespace boost { namespace fusion
{
struct vector_iterator_tag;
namespace extension
{
template <typename Tag>
struct value_of_impl;
template <>
struct value_of_impl<vector_iterator_tag>
{
template <typename Iterator>
struct apply
{
typedef typename Iterator::vector vector;
typedef typename Iterator::index index;
typedef typename mpl::at<
typename vector::types, index>::type
type;
};
};
}
}}
#endif

View File

@ -0,0 +1,39 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_VECTOR_FORWARD_CTOR_07122005_1123)
#define FUSION_VECTOR_FORWARD_CTOR_07122005_1123
#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/container/vector/detail/vector_forward_ctor.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
#include BOOST_PP_ITERATE()
#endif
#else // defined(BOOST_PP_IS_ITERATING)
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#define N BOOST_PP_ITERATION()
#if N == 1
explicit
#endif
vector(BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type _))
: vec(BOOST_PP_ENUM_PARAMS(N, _)) {}
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,150 @@
/*=============================================================================
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)
==============================================================================*/
// No include guard. This file is meant to be included many times
#if !defined(FUSION_MACRO_05042005)
#define FUSION_MACRO_05042005
#define FUSION_MEMBER_DEFAULT_INIT(z, n, _) m##n(T##n())
#define FUSION_MEMBER_INIT(z, n, _) m##n(_##n)
#define FUSION_COPY_INIT(z, n, _) m##n(other.m##n)
#define FUSION_MEMBER_DECL(z, n, _) T##n m##n;
#define FUSION_MEMBER_ASSIGN(z, n, _) \
this->BOOST_PP_CAT(m, n) = vec.BOOST_PP_CAT(m, n);
#define FUSION_DEREF_MEMBER_ASSIGN(z, n, _) \
this->BOOST_PP_CAT(m, n) = *BOOST_PP_CAT(i, n);
#define FUSION_AT_IMPL(z, n, _) \
typename add_reference<T##n>::type \
at_impl(mpl::int_<n>) { return this->m##n; } \
typename add_reference<typename add_const<T##n>::type>::type \
at_impl(mpl::int_<n>) const { return this->m##n; }
#define FUSION_ITER_DECL_VAR(z, n, _) \
typedef typename result_of::next< \
BOOST_PP_CAT(I, BOOST_PP_DEC(n))>::type BOOST_PP_CAT(I, n); \
BOOST_PP_CAT(I, n) BOOST_PP_CAT(i, n) \
= fusion::next(BOOST_PP_CAT(i, BOOST_PP_DEC(n)));
#endif
#define N BOOST_PP_ITERATION()
template <typename Derived, BOOST_PP_ENUM_PARAMS(N, typename T)>
struct BOOST_PP_CAT(vector_data, N) : sequence_base<Derived>
{
BOOST_PP_CAT(vector_data, N)()
: BOOST_PP_ENUM(N, FUSION_MEMBER_DEFAULT_INIT, _) {}
BOOST_PP_CAT(vector_data, N)(
BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type _))
: BOOST_PP_ENUM(N, FUSION_MEMBER_INIT, _) {}
BOOST_PP_CAT(vector_data, N)(
BOOST_PP_CAT(vector_data, N) const& other)
: BOOST_PP_ENUM(N, FUSION_COPY_INIT, _) {}
BOOST_PP_CAT(vector_data, N)&
operator=(BOOST_PP_CAT(vector_data, N) const& vec)
{
BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
return *this;
}
template <typename Sequence>
static BOOST_PP_CAT(vector_data, N)
init_from_sequence(Sequence const& seq)
{
typedef typename result_of::begin<Sequence const>::type I0;
I0 i0 = fusion::begin(seq);
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
return BOOST_PP_CAT(vector_data, N)(BOOST_PP_ENUM_PARAMS(N, *i));
}
BOOST_PP_REPEAT(N, FUSION_MEMBER_DECL, _)
};
template <BOOST_PP_ENUM_PARAMS(N, typename T)>
struct BOOST_PP_CAT(vector, N)
: BOOST_PP_CAT(vector_data, N)<
BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)>
, BOOST_PP_ENUM_PARAMS(N, T)>
{
typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> this_type;
typedef BOOST_PP_CAT(vector_data, N)<this_type, BOOST_PP_ENUM_PARAMS(N, T)> base_type;
typedef mpl::BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> types;
typedef vector_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef random_access_traversal_tag category;
typedef mpl::int_<N> size;
BOOST_PP_CAT(vector, N)() {}
#if (N == 1)
explicit
#endif
BOOST_PP_CAT(vector, N)(
BOOST_PP_ENUM_BINARY_PARAMS(
N, typename detail::call_param<T, >::type _))
: base_type(BOOST_PP_ENUM_PARAMS(N, _)) {}
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
BOOST_PP_CAT(vector, N)(
BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
: base_type(BOOST_PP_ENUM_PARAMS(N, vec.m)) {}
template <typename Sequence>
BOOST_PP_CAT(vector, N)(
Sequence const& seq
#if (N == 1)
, typename disable_if<is_convertible<Sequence, T0> >::type* dummy = 0
#endif
)
: base_type(base_type::init_from_sequence(seq)) {}
template <BOOST_PP_ENUM_PARAMS(N, typename U)>
BOOST_PP_CAT(vector, N)&
operator=(BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, U)> const& vec)
{
BOOST_PP_REPEAT(N, FUSION_MEMBER_ASSIGN, _)
return *this;
}
template <typename Sequence>
typename disable_if<is_convertible<Sequence, T0>, this_type&>::type
operator=(Sequence const& seq)
{
typedef typename result_of::begin<Sequence const>::type I0;
I0 i0 = fusion::begin(seq);
BOOST_PP_REPEAT_FROM_TO(1, N, FUSION_ITER_DECL_VAR, _)
BOOST_PP_REPEAT(N, FUSION_DEREF_MEMBER_ASSIGN, _)
return *this;
}
BOOST_PP_REPEAT(N, FUSION_AT_IMPL, _)
template<typename I>
typename add_reference<typename mpl::at<types, I>::type>::type
at_impl(I i)
{
return this->at_impl(mpl::int_<I::value>());
}
template<typename I>
typename add_reference<typename add_const<typename mpl::at<types, I>::type>::type>::type
at_impl(I i) const
{
return this->at_impl(mpl::int_<I::value>());
}
};
#undef N

View File

@ -0,0 +1,99 @@
/*=============================================================================
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)
==============================================================================*/
#ifndef BOOST_PP_IS_ITERATING
#if !defined(FUSION_VECTOR_N_CHOOSER_07072005_1248)
#define FUSION_VECTOR_N_CHOOSER_07072005_1248
#include <boost/fusion/container/vector/limits.hpp>
// include vector0..N where N is FUSION_MAX_VECTOR_SIZE
#include <boost/fusion/container/vector/vector10.hpp>
#if (FUSION_MAX_VECTOR_SIZE > 10)
#include <boost/fusion/container/vector/vector20.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 20)
#include <boost/fusion/container/vector/vector30.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 30)
#include <boost/fusion/container/vector/vector40.hpp>
#endif
#if (FUSION_MAX_VECTOR_SIZE > 40)
#include <boost/fusion/container/vector/vector50.hpp>
#endif
#include <boost/mpl/distance.hpp>
#include <boost/mpl/find.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
namespace boost { namespace fusion
{
struct void_;
}}
namespace boost { namespace fusion { namespace detail
{
template <int N>
struct get_vector_n;
template <>
struct get_vector_n<0>
{
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
struct call
{
typedef vector0 type;
};
};
#define BOOST_PP_FILENAME_1 \
<boost/fusion/container/vector/detail/vector_n_chooser.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
#include BOOST_PP_ITERATE()
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
struct vector_n_chooser
{
typedef
mpl::BOOST_PP_CAT(vector, FUSION_MAX_VECTOR_SIZE)
<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>
input;
typedef typename mpl::begin<input>::type begin;
typedef typename mpl::find<input, void_>::type end;
typedef typename mpl::distance<begin, end>::type size;
typedef typename get_vector_n<size::value>::template
call<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>::type
type;
};
}}}
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Preprocessor vertical repetition code
//
///////////////////////////////////////////////////////////////////////////////
#else // defined(BOOST_PP_IS_ITERATING)
#define N BOOST_PP_ITERATION()
template <>
struct get_vector_n<N>
{
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
struct call
{
typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> type;
};
};
#undef N
#endif // defined(BOOST_PP_IS_ITERATING)

View File

@ -0,0 +1,19 @@
/*=============================================================================
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_VECTOR_LIMITS_07072005_1246)
#define FUSION_VECTOR_LIMITS_07072005_1246
#if !defined(FUSION_MAX_VECTOR_SIZE)
# define FUSION_MAX_VECTOR_SIZE 10
#else
# if FUSION_MAX_VECTOR_SIZE < 3
# undef FUSION_MAX_VECTOR_SIZE
# define FUSION_MAX_VECTOR_SIZE 10
# endif
#endif
#endif

View File

@ -0,0 +1,152 @@
/*=============================================================================
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_VECTOR_07072005_1244)
#define FUSION_VECTOR_07072005_1244
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/detail/vector_n_chooser.hpp>
#include <boost/fusion/container/vector/detail/as_vector.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/detail/workaround.hpp>
namespace boost { namespace fusion
{
struct void_;
struct fusion_sequence_tag;
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename T)>
struct vector
: sequence_base<vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)> >
{
private:
typedef typename detail::vector_n_chooser<
BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, T)>::type
vector_n;
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
friend struct vector;
public:
typedef typename vector_n::types types;
typedef typename vector_n::fusion_tag fusion_tag;
typedef typename vector_n::tag tag;
typedef typename vector_n::size size;
typedef typename vector_n::category category;
typedef typename vector_n::is_view is_view;
vector()
: vec() {}
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
vector(vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, U)> const& rhs)
: vec(rhs.vec) {}
vector(vector const& rhs)
: vec(rhs.vec) {}
template <typename Sequence>
vector(Sequence const& rhs)
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
: vec(ctor_helper(rhs, is_base_of<vector, Sequence>())) {}
#else
: vec(rhs) {}
#endif
// Expand a couple of forwarding constructors for arguments
// of type (T0), (T0, T1), (T0, T1, T2) etc. Example:
//
// vector(
// typename detail::call_param<T0>::type _0
// , typename detail::call_param<T1>::type _1)
// : vec(_0, _1) {}
#include <boost/fusion/container/vector/detail/vector_forward_ctor.hpp>
template <BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, typename U)>
vector&
operator=(vector<BOOST_PP_ENUM_PARAMS(FUSION_MAX_VECTOR_SIZE, U)> const& rhs)
{
vec = rhs.vec;
return *this;
}
template <typename T>
vector&
operator=(T const& rhs)
{
vec = rhs;
return *this;
}
template <int N>
typename add_reference<
typename mpl::at_c<types, N>::type
>::type
at_impl(mpl::int_<N> index)
{
return vec.at_impl(index);
}
template <int N>
typename add_reference<
typename add_const<
typename mpl::at_c<types, N>::type
>::type
>::type
at_impl(mpl::int_<N> index) const
{
return vec.at_impl(index);
}
template <typename I>
typename add_reference<
typename mpl::at<types, I>::type
>::type
at_impl(I index)
{
return vec.at_impl(mpl::int_<I::value>());
}
template<typename I>
typename add_reference<
typename add_const<
typename mpl::at<types, I>::type
>::type
>::type
at_impl(I index) const
{
return vec.at_impl(mpl::int_<I::value>());
}
private:
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
static vector_n const&
ctor_helper(vector const& rhs, mpl::true_)
{
return rhs.vec;
}
template <typename T>
static T const&
ctor_helper(T const& rhs, mpl::false_)
{
return rhs;
}
#endif
vector_n vec;
};
}}
#endif

View File

@ -0,0 +1,66 @@
/*=============================================================================
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_VECTOR10_05042005_0257)
#define FUSION_VECTOR10_05042005_0257
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/container/vector/detail/at_impl.hpp>
#include <boost/fusion/container/vector/detail/value_at_impl.hpp>
#include <boost/fusion/container/vector/detail/begin_impl.hpp>
#include <boost/fusion/container/vector/detail/end_impl.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/vector/vector10.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_shifted.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
struct fusion_sequence_tag;
struct random_access_traversal_tag;
struct vector0 : sequence_base<vector0>
{
typedef mpl::vector0<> types;
typedef vector_tag fusion_tag;
typedef fusion_sequence_tag tag; // this gets picked up by MPL
typedef mpl::false_ is_view;
typedef random_access_traversal_tag category;
typedef mpl::int_<0> size;
vector0() {}
template<typename Sequence>
vector0(Sequence const& seq)
{}
};
// expand vector1 to vector10
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/detail/vector_n.hpp>
#define BOOST_PP_ITERATION_LIMITS (1, 10)
#include BOOST_PP_ITERATE()
}}
#endif

View File

@ -0,0 +1,50 @@
/*=============================================================================
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_VECTOR20_05052005_0205)
#define FUSION_VECTOR20_05052005_0205
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/container/vector/detail/at_impl.hpp>
#include <boost/fusion/container/vector/detail/value_at_impl.hpp>
#include <boost/fusion/container/vector/detail/begin_impl.hpp>
#include <boost/fusion/container/vector/detail/end_impl.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/vector/vector20.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_shifted.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
struct fusion_sequence_tag;
struct random_access_traversal_tag;
// expand vector11 to vector20
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/detail/vector_n.hpp>
#define BOOST_PP_ITERATION_LIMITS (11, 20)
#include BOOST_PP_ITERATE()
}}
#endif

View File

@ -0,0 +1,50 @@
/*=============================================================================
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_VECTOR30_05052005_0206)
#define FUSION_VECTOR30_05052005_0206
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/container/vector/detail/at_impl.hpp>
#include <boost/fusion/container/vector/detail/value_at_impl.hpp>
#include <boost/fusion/container/vector/detail/begin_impl.hpp>
#include <boost/fusion/container/vector/detail/end_impl.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/vector/vector30.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_shifted.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
struct fusion_sequence_tag;
struct random_access_traversal_tag;
// expand vector21 to vector30
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/detail/vector_n.hpp>
#define BOOST_PP_ITERATION_LIMITS (21, 30)
#include BOOST_PP_ITERATE()
}}
#endif

View File

@ -0,0 +1,50 @@
/*=============================================================================
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_VECTOR40_05052005_0208)
#define FUSION_VECTOR40_05052005_0208
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/container/vector/detail/at_impl.hpp>
#include <boost/fusion/container/vector/detail/value_at_impl.hpp>
#include <boost/fusion/container/vector/detail/begin_impl.hpp>
#include <boost/fusion/container/vector/detail/end_impl.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/vector/vector40.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_shifted.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
struct fusion_sequence_tag;
struct random_access_traversal_tag;
// expand vector31 to vector40
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/detail/vector_n.hpp>
#define BOOST_PP_ITERATION_LIMITS (31, 40)
#include BOOST_PP_ITERATE()
}}
#endif

View File

@ -0,0 +1,50 @@
/*=============================================================================
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_VECTOR50_05052005_0207)
#define FUSION_VECTOR50_05052005_0207
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/container/vector/detail/at_impl.hpp>
#include <boost/fusion/container/vector/detail/value_at_impl.hpp>
#include <boost/fusion/container/vector/detail/begin_impl.hpp>
#include <boost/fusion/container/vector/detail/end_impl.hpp>
#include <boost/mpl/void.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/vector/vector50.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/preprocessor/dec.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_shifted.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
namespace boost { namespace fusion
{
struct vector_tag;
struct fusion_sequence_tag;
struct random_access_traversal_tag;
// expand vector41 to vector50
#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/detail/vector_n.hpp>
#define BOOST_PP_ITERATION_LIMITS (41, 50)
#include BOOST_PP_ITERATE()
}}
#endif

View File

@ -0,0 +1,25 @@
/*=============================================================================
Copyright (c) 1999-2003 Jaakko J<>rvi
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_VECTOR_FORWARD_07072005_0125)
#define FUSION_VECTOR_FORWARD_07072005_0125
#include <boost/fusion/container/vector/limits.hpp>
#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
namespace boost { namespace fusion
{
struct void_;
template <
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
FUSION_MAX_VECTOR_SIZE, typename T, void_)
>
struct vector;
}}
#endif

View File

@ -0,0 +1,46 @@
/*=============================================================================
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_VECTOR_ITERATOR_05042005_0635)
#define FUSION_VECTOR_ITERATOR_05042005_0635
#include <boost/fusion/support/iterator_base.hpp>
#include <boost/fusion/container/vector/detail/deref_impl.hpp>
#include <boost/fusion/container/vector/detail/value_of_impl.hpp>
#include <boost/fusion/container/vector/detail/next_impl.hpp>
#include <boost/fusion/container/vector/detail/prior_impl.hpp>
#include <boost/fusion/container/vector/detail/equal_to_impl.hpp>
#include <boost/fusion/container/vector/detail/distance_impl.hpp>
#include <boost/fusion/container/vector/detail/advance_impl.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/mpl/int.hpp>
namespace boost { namespace fusion
{
struct vector_iterator_tag;
struct random_access_traversal_tag;
template <typename Vector, int N>
struct vector_iterator_identity;
template <typename Vector, int N>
struct vector_iterator : iterator_base<vector_iterator<Vector, N> >
{
typedef mpl::int_<N> index;
typedef Vector vector;
typedef vector_iterator_tag fusion_tag;
typedef random_access_traversal_tag category;
typedef vector_iterator_identity<
typename add_const<Vector>::type, N> identity;
vector_iterator(Vector& vec)
: vec(vec) {}
Vector& vec;
};
}}
#endif