Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / fusion / view / nview / detail / advance_impl.hpp
1 /*=============================================================================
2     Copyright (c) 2009 Hartmut Kaiser
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
8 #if !defined(BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM)
9 #define BOOST_FUSION_NVIEW_ADVANCE_IMPL_SEP_24_2009_0212PM
10
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/mpl/advance.hpp>
13 #include <boost/fusion/iterator/advance.hpp>
14
15 namespace boost { namespace fusion 
16 {
17     struct nview_iterator_tag;
18
19     template <typename Sequence, typename Pos>
20     struct nview_iterator;
21
22     namespace extension
23     {
24         template<typename Tag>
25         struct advance_impl;
26
27         template<>
28         struct advance_impl<nview_iterator_tag>
29         {
30             template<typename Iterator, typename Dist>
31             struct apply
32             {
33                 typedef typename Iterator::first_type::iterator_type iterator_type;
34                 typedef typename Iterator::sequence_type sequence_type;
35
36                 typedef nview_iterator<sequence_type, 
37                     typename mpl::advance<iterator_type, Dist>::type> type;
38
39                 BOOST_FUSION_GPU_ENABLED
40                 static type
41                 call(Iterator const& i)
42                 {
43                     return type(i.seq);
44                 }
45             };
46         };
47     }
48
49 }}
50
51 #endif