[857] | 1 | /*=============================================================================
|
---|
| 2 | Copyright (c) 2003 Joel de Guzman
|
---|
| 3 |
|
---|
| 4 | Use, modification and distribution is subject to the Boost Software
|
---|
| 5 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 6 | http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 7 | ==============================================================================*/
|
---|
| 8 | #if !defined(FUSION_ALGORITHM_PUSH_FRONT_HPP)
|
---|
| 9 | #define FUSION_ALGORITHM_PUSH_FRONT_HPP
|
---|
| 10 |
|
---|
| 11 | #include <boost/spirit/fusion/sequence/prepend_view.hpp>
|
---|
| 12 |
|
---|
| 13 | namespace boost { namespace fusion
|
---|
| 14 | {
|
---|
| 15 | namespace meta
|
---|
| 16 | {
|
---|
| 17 | template <typename Sequence, typename T>
|
---|
| 18 | struct push_front
|
---|
| 19 | {
|
---|
| 20 | typedef prepend_view<Sequence, T> type;
|
---|
| 21 | };
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | namespace function
|
---|
| 25 | {
|
---|
| 26 | struct push_front
|
---|
| 27 | {
|
---|
| 28 | template <typename Sequence, typename T>
|
---|
| 29 | struct apply : meta::push_front<Sequence, T> {};
|
---|
| 30 |
|
---|
| 31 | template <typename Sequence, typename T>
|
---|
| 32 | inline typename apply<Sequence const, T>::type
|
---|
| 33 | operator()(Sequence const& seq, T const& x) const
|
---|
| 34 | {
|
---|
| 35 | typedef prepend_view<Sequence const, T> result;
|
---|
| 36 | return result(seq, x);
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | template <typename Sequence, typename T>
|
---|
| 40 | inline typename apply<Sequence, T>::type
|
---|
| 41 | operator()(Sequence& seq, T const& x) const
|
---|
| 42 | {
|
---|
| 43 | typedef prepend_view<Sequence, T> result;
|
---|
| 44 | return result(seq, x);
|
---|
| 45 | }
|
---|
| 46 | };
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | function::push_front const push_front = function::push_front();
|
---|
| 50 | }}
|
---|
| 51 |
|
---|
| 52 | #endif
|
---|
| 53 |
|
---|