]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/fusion/view/zip_view/detail/at_impl.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / fusion / view / zip_view / detail / at_impl.hpp
1 /*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3 Copyright (c) 2006 Dan Marsden
4
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_AT_IMPL_20060124_1933)
9 #define FUSION_AT_IMPL_20060124_1933
10
11 #include <boost/fusion/support/config.hpp>
12 #include <boost/fusion/container/vector.hpp>
13 #include <boost/fusion/sequence/intrinsic/at.hpp>
14 #include <boost/fusion/container/vector/convert.hpp>
15 #include <boost/fusion/algorithm/transformation/transform.hpp>
16 #include <boost/type_traits/remove_reference.hpp>
17 #include <boost/type_traits/is_reference.hpp>
18 #include <boost/mpl/assert.hpp>
19 #include <boost/fusion/support/unused.hpp>
20 #include <boost/mpl/eval_if.hpp>
21 #include <boost/mpl/identity.hpp>
22 #include <boost/type_traits/is_same.hpp>
23
24
25 namespace boost { namespace fusion
26 {
27 struct zip_view_tag;
28
29 namespace detail
30 {
31 template<typename N>
32 struct poly_at
33 {
34 template<typename T>
35 struct result;
36
37 template<typename N1, typename SeqRef>
38 struct result<poly_at<N1>(SeqRef)>
39 : mpl::eval_if<is_same<SeqRef, unused_type const&>,
40 mpl::identity<unused_type>,
41 result_of::at<typename remove_reference<SeqRef>::type, N> >
42 {
43 BOOST_MPL_ASSERT((is_reference<SeqRef>));
44 };
45
46 template<typename Seq>
47 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
48 typename result<poly_at(Seq&)>::type
49 operator()(Seq& seq) const
50 {
51 return fusion::at<N>(seq);
52 }
53
54 template<typename Seq>
55 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
56 typename result<poly_at(Seq const&)>::type
57 operator()(Seq const& seq) const
58 {
59 return fusion::at<N>(seq);
60 }
61
62 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
63 unused_type operator()(unused_type const&) const
64 {
65 return unused_type();
66 }
67 };
68 }
69
70 namespace extension
71 {
72 template<typename Tag>
73 struct at_impl;
74
75 template<>
76 struct at_impl<zip_view_tag>
77 {
78 template<typename Seq, typename N>
79 struct apply
80 {
81 typedef typename result_of::as_vector<
82 typename result_of::transform<
83 typename Seq::sequences, detail::poly_at<N> >::type>::type type;
84
85 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
86 static type
87 call(Seq& seq)
88 {
89 return type(
90 fusion::transform(seq.sequences_, detail::poly_at<N>()));
91 }
92 };
93 };
94 }
95 }}
96
97 #endif