| 1 | /*============================================================================= |
|---|---|
| 2 | Copyright (c) 2007 Tobias Schwinger |
| 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_ITERATOR_RANGE_AT_IMPL_HPP_INCLUDED) |
| 9 | #define BOOST_FUSION_ITERATOR_RANGE_AT_IMPL_HPP_INCLUDED |
| 10 | |
| 11 | #include <boost/fusion/support/config.hpp> |
| 12 | #include <boost/fusion/iterator/advance.hpp> |
| 13 | #include <boost/fusion/iterator/deref.hpp> |
| 14 | |
| 15 | namespace boost { namespace fusion |
| 16 | { |
| 17 | struct iterator_range_tag; |
| 18 | |
| 19 | namespace extension |
| 20 | { |
| 21 | template <typename Tag> |
| 22 | struct at_impl; |
| 23 | |
| 24 | template <> |
| 25 | struct at_impl<iterator_range_tag> |
| 26 | { |
| 27 | template <typename Seq, typename N> |
| 28 | struct apply |
| 29 | { |
| 30 | typedef typename Seq::begin_type begin_type; |
| 31 | typedef typename result_of::advance<begin_type,N>::type pos; |
| 32 | typedef typename result_of::deref<pos>::type type; |
| 33 | |
| 34 | BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED |
| 35 | static type |
| 36 | call(Seq& s) |
| 37 | { |
| 38 | return * fusion::advance<N>(s.first); |
| 39 | } |
| 40 | }; |
| 41 | }; |
| 42 | } |
| 43 | }} |
| 44 | |
| 45 | #endif |
| 46 | |
| 47 |
