[857] | 1 | /*=============================================================================
|
---|
| 2 | Copyright (c) 2003 Joel de Guzman
|
---|
| 3 | Copyright (c) 2004 Peder Holt
|
---|
| 4 |
|
---|
| 5 | Use, modification and distribution is subject to the Boost Software
|
---|
| 6 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 7 | http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 8 | ==============================================================================*/
|
---|
| 9 | #if !defined(FUSION_ITERATOR_PRIOR_HPP)
|
---|
| 10 | #define FUSION_ITERATOR_PRIOR_HPP
|
---|
| 11 |
|
---|
| 12 | #include <boost/spirit/fusion/detail/config.hpp>
|
---|
| 13 | #include <boost/spirit/fusion/iterator/as_fusion_iterator.hpp>
|
---|
| 14 |
|
---|
| 15 | namespace boost { namespace fusion
|
---|
| 16 | {
|
---|
| 17 | namespace meta
|
---|
| 18 | {
|
---|
| 19 | template <typename Tag>
|
---|
| 20 | struct prior_impl
|
---|
| 21 | {
|
---|
| 22 | template <typename Iterator>
|
---|
| 23 | struct apply {};
|
---|
| 24 | };
|
---|
| 25 |
|
---|
| 26 | template <typename Iterator>
|
---|
| 27 | struct prior
|
---|
| 28 | {
|
---|
| 29 | typedef as_fusion_iterator<Iterator> converter;
|
---|
| 30 | typedef typename converter::type iter;
|
---|
| 31 |
|
---|
| 32 | typedef typename
|
---|
| 33 | prior_impl<FUSION_GET_TAG(iter)>::
|
---|
| 34 | template apply<iter>::type
|
---|
| 35 | type;
|
---|
| 36 | };
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | template <typename Iterator>
|
---|
| 40 | inline typename meta::prior<Iterator>::type
|
---|
| 41 | prior(Iterator const& i)
|
---|
| 42 | {
|
---|
| 43 | typedef as_fusion_iterator<Iterator> converter;
|
---|
| 44 | typedef typename converter::type iter;
|
---|
| 45 |
|
---|
| 46 | return meta::prior_impl<FUSION_GET_TAG(iter)>::
|
---|
| 47 | template apply<iter>::call(converter::convert(i));
|
---|
| 48 | }
|
---|
| 49 | }}
|
---|
| 50 |
|
---|
| 51 | #endif
|
---|