1 /*============================================================================= 2 Copyright (c) 2001-2011 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 #if !defined(FUSION_CONVERT_09222005_1104) 8 #define FUSION_CONVERT_09222005_1104 9 10 #include <boost/fusion/support/config.hpp> 11 #include <boost/fusion/container/vector/detail/as_vector.hpp> 12 #include <boost/fusion/container/vector/detail/convert_impl.hpp> 13 #include <boost/fusion/container/vector/vector.hpp> 14 #include <boost/fusion/sequence/intrinsic/begin.hpp> 15 #include <boost/fusion/sequence/intrinsic/size.hpp> 16 17 namespace boost { namespace fusion 18 { 19 namespace result_of 20 { 21 template <typename Sequence> 22 struct as_vector 23 { 24 typedef typename detail::as_vector<result_of::size<Sequence>::value> gen; 25 typedef typename gen:: 26 template apply<typename result_of::begin<Sequence>::type>::type 27 type; 28 }; 29 } 30 31 template <typename Sequence> 32 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 33 inline typename result_of::as_vector<Sequence>::type as_vector(Sequence & seq)34 as_vector(Sequence& seq) 35 { 36 typedef typename result_of::as_vector<Sequence>::gen gen; 37 return gen::call(fusion::begin(seq)); 38 } 39 40 template <typename Sequence> 41 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED 42 inline typename result_of::as_vector<Sequence const>::type as_vector(Sequence const & seq)43 as_vector(Sequence const& seq) 44 { 45 typedef typename result_of::as_vector<Sequence const>::gen gen; 46 return gen::call(fusion::begin(seq)); 47 } 48 }} 49 50 #endif 51