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_BACK_07162005_0235) |
8 | #define FUSION_PUSH_BACK_07162005_0235 |
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_back |
23 | { |
24 | typedef fusion::single_view<typename detail::as_fusion_element<T>::type> single_view; |
25 | typedef joint_view<Sequence, single_view const> 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_back<Sequence const, T> |
35 | >::type |
36 | push_back(Sequence const& seq, T const& x) |
37 | { |
38 | typedef typename result_of::push_back<Sequence const, T> push_back; |
39 | typedef typename push_back::single_view single_view; |
40 | typedef typename push_back::type result; |
41 | single_view x_(x); |
42 | return result(seq, x_); |
43 | } |
44 | }} |
45 | |
46 | #endif |
47 | |
48 |