| 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_09232005_1215) |
| 8 | #define FUSION_CONVERT_09232005_1215 |
| 9 | |
| 10 | #include <boost/fusion/support/config.hpp> |
| 11 | #include <boost/fusion/container/list/cons.hpp> |
| 12 | #include <boost/fusion/container/list/detail/build_cons.hpp> |
| 13 | #include <boost/fusion/container/list/detail/convert_impl.hpp> |
| 14 | #include <boost/fusion/sequence/intrinsic/empty.hpp> |
| 15 | #include <boost/fusion/sequence/intrinsic/begin.hpp> |
| 16 | #include <boost/fusion/sequence/intrinsic/end.hpp> |
| 17 | |
| 18 | namespace boost { namespace fusion |
| 19 | { |
| 20 | namespace result_of |
| 21 | { |
| 22 | template <typename Sequence> |
| 23 | struct as_list |
| 24 | { |
| 25 | typedef typename |
| 26 | detail::build_cons< |
| 27 | typename result_of::begin<Sequence>::type |
| 28 | , typename result_of::end<Sequence>::type |
| 29 | > |
| 30 | build_cons; |
| 31 | |
| 32 | typedef typename build_cons::type type; |
| 33 | |
| 34 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 35 | static type |
| 36 | call(Sequence& seq) |
| 37 | { |
| 38 | return build_cons::call(fusion::begin(seq), fusion::end(seq)); |
| 39 | } |
| 40 | }; |
| 41 | } |
| 42 | |
| 43 | template <typename Sequence> |
| 44 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 45 | inline typename result_of::as_list<Sequence>::type |
| 46 | as_list(Sequence& seq) |
| 47 | { |
| 48 | return result_of::as_list<Sequence>::call(seq); |
| 49 | } |
| 50 | |
| 51 | template <typename Sequence> |
| 52 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 53 | inline typename result_of::as_list<Sequence const>::type |
| 54 | as_list(Sequence const& seq) |
| 55 | { |
| 56 | return result_of::as_list<Sequence const>::call(seq); |
| 57 | } |
| 58 | }} |
| 59 | |
| 60 | #endif |
| 61 |