Project revived from Feb2017
[EroSomnia.git] / deps / boost_1_63_0 / boost / fusion / view / zip_view / detail / end_impl.hpp
blob28549cb7d9f27645ffe1fbf7acbbe94c1e73924c
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3 Copyright (c) 2006 Dan Marsden
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(FUSION_END_IMPL_20060123_2208)
9 #define FUSION_END_IMPL_20060123_2208
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/view/zip_view/zip_view_iterator_fwd.hpp>
13 #include <boost/fusion/sequence/intrinsic/end.hpp>
14 #include <boost/fusion/sequence/intrinsic/begin.hpp>
15 #include <boost/fusion/sequence/intrinsic/size.hpp>
16 #include <boost/fusion/sequence/intrinsic/front.hpp>
17 #include <boost/fusion/iterator/advance.hpp>
18 #include <boost/fusion/algorithm/transformation/transform.hpp>
19 #include <boost/type_traits/remove_reference.hpp>
20 #include <boost/type_traits/is_reference.hpp>
21 #include <boost/mpl/assert.hpp>
22 #include <boost/mpl/min.hpp>
24 #include <boost/mpl/eval_if.hpp>
25 #include <boost/mpl/identity.hpp>
26 #include <boost/type_traits/is_same.hpp>
28 namespace boost { namespace fusion {
30 struct zip_view_tag;
32 namespace detail
34 template<typename SeqRef, typename M>
35 struct get_endpoint
37 typedef typename remove_reference<SeqRef>::type Seq;
38 typedef typename result_of::begin<Seq>::type begin;
39 typedef typename result_of::advance<begin, M>::type type;
42 template<typename M>
43 struct endpoints
45 template<typename T>
46 struct result;
48 template<typename M1, typename SeqRef>
49 struct result<endpoints<M1>(SeqRef)>
50 : mpl::eval_if<is_same<SeqRef, unused_type const&>,
51 mpl::identity<unused_type>,
52 get_endpoint<SeqRef, M> >
54 BOOST_MPL_ASSERT((is_reference<SeqRef>));
57 template<typename Seq>
58 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
59 typename result<endpoints(Seq&)>::type
60 operator()(Seq& seq) const
62 return fusion::advance<M>(fusion::begin(seq));
65 template<typename Seq>
66 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
67 typename result<endpoints(Seq const&)>::type
68 operator()(Seq const& seq) const
70 return fusion::advance<M>(fusion::begin(seq));
73 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
74 unused_type operator()(unused_type const&) const
76 return unused_type();
81 namespace extension
83 template<typename Tag>
84 struct end_impl;
86 template<>
87 struct end_impl<zip_view_tag>
89 template<typename Sequence>
90 struct apply
92 typedef zip_view_iterator<
93 typename result_of::transform<typename Sequence::sequences, detail::endpoints<typename Sequence::size> >::type,
94 typename Sequence::category> type;
96 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
97 static type
98 call(Sequence& sequence)
100 return type(
101 fusion::transform(sequence.sequences_, detail::endpoints<typename Sequence::size>()));
108 #endif