Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:40

0001 /*=============================================================================
0002     Copyright (c) 2014-2015 Kohei Takahashi
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 ==============================================================================*/
0007 #ifndef FUSION_AS_VECTOR_11052014_1801
0008 #define FUSION_AS_VECTOR_11052014_1801
0009 
0010 #include <boost/fusion/support/config.hpp>
0011 #include <boost/fusion/container/vector/detail/config.hpp>
0012 
0013 ///////////////////////////////////////////////////////////////////////////////
0014 // Without variadics, we will use the PP version
0015 ///////////////////////////////////////////////////////////////////////////////
0016 #if !defined(BOOST_FUSION_HAS_VARIADIC_VECTOR)
0017 # include <boost/fusion/container/vector/detail/cpp03/as_vector.hpp>
0018 #else
0019 
0020 ///////////////////////////////////////////////////////////////////////////////
0021 // C++11 interface
0022 ///////////////////////////////////////////////////////////////////////////////
0023 #include <boost/fusion/support/detail/index_sequence.hpp>
0024 #include <boost/fusion/container/vector/vector.hpp>
0025 #include <boost/fusion/iterator/value_of.hpp>
0026 #include <boost/fusion/iterator/deref.hpp>
0027 #include <boost/fusion/iterator/advance.hpp>
0028 #include <cstddef>
0029 
0030 namespace boost { namespace fusion { namespace detail
0031 {
0032 BOOST_FUSION_BARRIER_BEGIN
0033 
0034     template <typename Indices>
0035     struct as_vector_impl;
0036 
0037     template <std::size_t ...Indices>
0038     struct as_vector_impl<index_sequence<Indices...> >
0039     {
0040         template <typename Iterator>
0041         struct apply
0042         {
0043             typedef vector<
0044                 typename result_of::value_of<
0045                     typename result_of::advance_c<Iterator, Indices>::type
0046                 >::type...
0047             > type;
0048         };
0049 
0050         template <typename Iterator>
0051         BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
0052         static typename apply<Iterator>::type
0053         call(Iterator i)
0054         {
0055             typedef typename apply<Iterator>::type result;
0056             return result(*advance_c<Indices>(i)...);
0057         }
0058     };
0059 
0060     template <int size>
0061     struct as_vector
0062         : as_vector_impl<typename make_index_sequence<size>::type> {};
0063 
0064 BOOST_FUSION_BARRIER_END
0065 }}}
0066 
0067 #endif
0068 #endif
0069 
0070