]>
Commit | Line | Data |
---|---|---|
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_PUSH_FRONT_07162005_0749) | |
8 | #define FUSION_PUSH_FRONT_07162005_0749 | |
9 | ||
10 | #include <boost/fusion/support/config.hpp> | |
11 | #include <boost/fusion/support/detail/as_fusion_element.hpp> | |
12 | #include <boost/fusion/view/joint_view/joint_view.hpp> | |
13 | #include <boost/fusion/view/single_view/single_view.hpp> | |
14 | #include <boost/fusion/support/is_sequence.hpp> | |
15 | #include <boost/utility/enable_if.hpp> | |
16 | ||
17 | namespace boost { namespace fusion | |
18 | { | |
19 | namespace result_of | |
20 | { | |
21 | template <typename Sequence, typename T> | |
22 | struct push_front | |
23 | { | |
24 | typedef fusion::single_view<typename detail::as_fusion_element<T>::type> single_view; | |
25 | typedef joint_view<single_view const, Sequence> type; | |
26 | }; | |
27 | } | |
28 | ||
29 | template <typename Sequence, typename T> | |
30 | BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED | |
31 | inline typename | |
32 | lazy_enable_if< | |
33 | traits::is_sequence<Sequence> | |
34 | , result_of::push_front<Sequence const, T> | |
35 | >::type | |
36 | push_front(Sequence const& seq, T const& x) | |
37 | { | |
38 | typedef typename result_of::push_front<Sequence const, T> push_front; | |
39 | typedef typename push_front::single_view single_view; | |
40 | typedef typename push_front::type result; | |
41 | single_view x_(x); | |
42 | return result(x_, seq); | |
43 | } | |
44 | }} | |
45 | ||
46 | #endif | |
47 |