1 | /*============================================================================= |
---|
2 | Copyright (c) 2001-2003 Joel de Guzman |
---|
3 | |
---|
4 | Use, modification and distribution is subject to the Boost Software |
---|
5 | License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
---|
6 | http://www.boost.org/LICENSE_1_0.txt) |
---|
7 | ==============================================================================*/ |
---|
8 | #if !defined(FUSION_SEQUENCE_TUPLE_ELEMENT_HPP) |
---|
9 | #define FUSION_SEQUENCE_TUPLE_ELEMENT_HPP |
---|
10 | |
---|
11 | #include <boost/spirit/fusion/sequence/value_at.hpp> |
---|
12 | #include <utility> |
---|
13 | |
---|
14 | namespace boost { namespace fusion |
---|
15 | { |
---|
16 | /////////////////////////////////////////////////////////////////////////// |
---|
17 | // |
---|
18 | // tuple_element metafunction |
---|
19 | // |
---|
20 | // Given a constant integer N and a Sequence, returns the |
---|
21 | // tuple element type at slot N. (N is a zero based index). Usage: |
---|
22 | // |
---|
23 | // tuple_element<N, Sequence>::type |
---|
24 | // |
---|
25 | // This metafunction is provided here for compatibility with the |
---|
26 | // tuples TR1 specification. This metafunction forwards to |
---|
27 | // meta::value_at_c<Sequence>. |
---|
28 | // |
---|
29 | /////////////////////////////////////////////////////////////////////////// |
---|
30 | template <int N, typename Sequence> |
---|
31 | struct tuple_element : meta::value_at_c<Sequence, N> {}; |
---|
32 | |
---|
33 | template<typename T1, typename T2> |
---|
34 | struct tuple_element<0, std::pair<T1, T2> > |
---|
35 | { |
---|
36 | typedef T1 type; |
---|
37 | }; |
---|
38 | |
---|
39 | template<typename T1, typename T2> |
---|
40 | struct tuple_element<1, std::pair<T1, T2> > |
---|
41 | { |
---|
42 | typedef T2 type; |
---|
43 | }; |
---|
44 | }} |
---|
45 | |
---|
46 | #endif |
---|