phase4: refactoring for v2.1

[SVN r40213]
This commit is contained in:
Joel de Guzman
2007-10-20 13:13:58 +00:00
parent e894481f5b
commit c35180f4f9
43 changed files with 400 additions and 200 deletions

View File

@ -2,13 +2,14 @@
Copyright (c) 2001-2006 Joel de Guzman
Copyright (c) 2005-2006 Dan Marsden
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(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,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,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,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

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_SEQUENCE_CLASS_LIST_10022005_0605)
@ -12,5 +12,6 @@
#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,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,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

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_SEQUENCE_CLASS_MAP_10022005_0606)
@ -10,5 +10,6 @@
#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,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

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_SEQUENCE_CLASS_SET_10022005_0607)
@ -10,5 +10,6 @@
#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,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

@ -1,7 +1,7 @@
/*=============================================================================
Copyright (c) 2001-2006 Joel de Guzman
Distributed under the Boost Software License, Version 1.0. (See accompanying
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(FUSION_SEQUENCE_CLASS_VECTOR_10022005_0602)
@ -16,5 +16,6 @@
#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,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,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

@ -9,7 +9,7 @@
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/detail/vector_n_chooser.hpp>
#include <boost/fusion/sequence/conversion/detail/as_vector.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>