]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_VALUE_AT_IMPL_20060124_2129) | |
9 | #define FUSION_VALUE_AT_IMPL_20060124_2129 | |
10 | ||
11 | #include <boost/fusion/support/config.hpp> | |
12 | #include <boost/fusion/container/vector/convert.hpp> | |
13 | #include <boost/fusion/algorithm/transformation/transform.hpp> | |
14 | #include <boost/fusion/sequence/intrinsic/value_at.hpp> | |
15 | #include <boost/type_traits/remove_reference.hpp> | |
16 | #include <boost/fusion/support/unused.hpp> | |
17 | #include <boost/mpl/eval_if.hpp> | |
18 | #include <boost/mpl/identity.hpp> | |
19 | #include <boost/type_traits/is_same.hpp> | |
20 | #include <boost/config.hpp> | |
21 | ||
22 | namespace boost { namespace fusion { | |
23 | ||
24 | struct zip_view_tag; | |
25 | ||
26 | namespace detail | |
27 | { | |
28 | template<typename N> | |
29 | struct poly_value_at | |
30 | { | |
31 | template<typename T> | |
32 | struct result; | |
33 | ||
34 | template<typename N1, typename Seq> | |
35 | struct result<poly_value_at<N1>(Seq)> | |
36 | : mpl::eval_if<is_same<Seq, unused_type const&>, | |
37 | mpl::identity<unused_type>, | |
38 | result_of::value_at<typename remove_reference<Seq>::type, N> > | |
39 | {}; | |
40 | ||
41 | // never called, but needed for decltype-based result_of (C++0x) | |
42 | #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES | |
43 | template<typename Seq> | |
44 | BOOST_FUSION_GPU_ENABLED | |
45 | typename result<poly_value_at(Seq)>::type | |
46 | operator()(Seq&&) const; | |
47 | #endif | |
48 | }; | |
49 | } | |
50 | ||
51 | namespace extension | |
52 | { | |
53 | template<typename Tag> | |
54 | struct value_at_impl; | |
55 | ||
56 | template<> | |
57 | struct value_at_impl<zip_view_tag> | |
58 | { | |
59 | template<typename Sequence, typename N> | |
60 | struct apply | |
61 | { | |
62 | typedef typename result_of::transform< | |
63 | typename Sequence::sequences, | |
64 | detail::poly_value_at<N> >::type values; | |
65 | typedef typename result_of::as_vector<values>::type type; | |
66 | }; | |
67 | }; | |
68 | } | |
69 | }} | |
70 | ||
71 | #endif |