PageRenderTime 47ms CodeModel.GetById 36ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/Src/Dependencies/Boost/boost/fusion/container/vector/detail/as_vector.hpp

http://hadesmem.googlecode.com/
C++ Header | 101 lines | 74 code | 16 blank | 11 comment | 0 complexity | 629b36fc05eef56ae5b1c7e7233d94ef MD5 | raw file
  1/*=============================================================================
  2    Copyright (c) 2001-2006 Joel de Guzman
  3
  4    Distributed under the Boost Software License, Version 1.0. (See accompanying
  5    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6==============================================================================*/
  7#ifndef BOOST_PP_IS_ITERATING
  8#if !defined(FUSION_AS_VECTOR_09222005_0950)
  9#define FUSION_AS_VECTOR_09222005_0950
 10
 11#include <boost/preprocessor/iterate.hpp>
 12#include <boost/preprocessor/repetition/enum_params.hpp>
 13#include <boost/preprocessor/repetition/enum_binary_params.hpp>
 14#include <boost/preprocessor/repetition/repeat.hpp>
 15#include <boost/preprocessor/cat.hpp>
 16#include <boost/preprocessor/inc.hpp>
 17#include <boost/preprocessor/dec.hpp>
 18#include <boost/fusion/container/vector/vector.hpp>
 19#include <boost/fusion/iterator/value_of.hpp>
 20#include <boost/fusion/iterator/deref.hpp>
 21#include <boost/fusion/iterator/next.hpp>
 22
 23namespace boost { namespace fusion { namespace detail
 24{
 25    template <int size>
 26    struct as_vector;
 27
 28    template <>
 29    struct as_vector<0>
 30    {
 31        template <typename Iterator>
 32        struct apply
 33        {
 34            typedef vector0<> type;
 35        };
 36
 37        template <typename Iterator>
 38        static typename apply<Iterator>::type
 39        call(Iterator)
 40        {
 41            return vector0<>();
 42        }
 43    };
 44
 45#define BOOST_FUSION_NEXT_ITERATOR(z, n, data)                                  \
 46    typedef typename fusion::result_of::next<BOOST_PP_CAT(I, n)>::type          \
 47        BOOST_PP_CAT(I, BOOST_PP_INC(n));
 48
 49#define BOOST_FUSION_NEXT_CALL_ITERATOR(z, n, data)                             \
 50    typename gen::BOOST_PP_CAT(I, BOOST_PP_INC(n))                              \
 51        BOOST_PP_CAT(i, BOOST_PP_INC(n)) = fusion::next(BOOST_PP_CAT(i, n));
 52
 53#define BOOST_FUSION_VALUE_OF_ITERATOR(z, n, data)                              \
 54    typedef typename fusion::result_of::value_of<BOOST_PP_CAT(I, n)>::type      \
 55        BOOST_PP_CAT(T, n);
 56
 57#define BOOST_PP_FILENAME_1 <boost/fusion/container/vector/detail/as_vector.hpp>
 58#define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_VECTOR_SIZE)
 59#include BOOST_PP_ITERATE()
 60
 61#undef BOOST_FUSION_NEXT_ITERATOR
 62#undef BOOST_FUSION_NEXT_CALL_ITERATOR
 63#undef BOOST_FUSION_VALUE_OF_ITERATOR
 64
 65}}}
 66
 67#endif
 68#else // defined(BOOST_PP_IS_ITERATING)
 69///////////////////////////////////////////////////////////////////////////////
 70//
 71//  Preprocessor vertical repetition code
 72//
 73///////////////////////////////////////////////////////////////////////////////
 74
 75#define N BOOST_PP_ITERATION()
 76
 77    template <>
 78    struct as_vector<N>
 79    {
 80        template <typename I0>
 81        struct apply
 82        {
 83            BOOST_PP_REPEAT(N, BOOST_FUSION_NEXT_ITERATOR, _)
 84            BOOST_PP_REPEAT(N, BOOST_FUSION_VALUE_OF_ITERATOR, _)
 85            typedef BOOST_PP_CAT(vector, N)<BOOST_PP_ENUM_PARAMS(N, T)> type;
 86        };
 87
 88        template <typename Iterator>
 89        static typename apply<Iterator>::type
 90        call(Iterator const& i0)
 91        {
 92            typedef apply<Iterator> gen;
 93            typedef typename gen::type result;
 94            BOOST_PP_REPEAT(BOOST_PP_DEC(N), BOOST_FUSION_NEXT_CALL_ITERATOR, _)
 95            return result(BOOST_PP_ENUM_PARAMS(N, *i));
 96        }
 97    };
 98
 99#undef N
100#endif // defined(BOOST_PP_IS_ITERATING)
101