1// tuple.hpp - Boost Tuple Library --------------------------------------
2
3// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
4//
5// Distributed under the Boost Software License, Version 1.0. (See
6// accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8
9// For more information, see http://www.boost.org
10
11// -----------------------------------------------------------------
12
13#ifndef BOOST_TUPLE_HPP
14#define BOOST_TUPLE_HPP
15
16#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730
17// Work around a compiler bug.
18// boost::python::tuple has to be seen by the compiler before the
19// boost::tuple class template.
20namespace boost { namespace python { class tuple; }}
21#endif
22
23#include <boost/config.hpp>
24#include <boost/static_assert.hpp>
25
26// other compilers
27#include <boost/ref.hpp>
28#include <boost/tuple/detail/tuple_basic.hpp>
29
30
31namespace boost {
32
33using tuples::tuple;
34using tuples::make_tuple;
35using tuples::tie;
36#if !defined(BOOST_NO_USING_TEMPLATE)
37using tuples::get;
38#else
39//
40// The "using tuples::get" statement causes the
41// Borland compiler to ICE, use forwarding
42// functions instead:
43//
44template<int N, class HT, class TT>
45inline typename tuples::access_traits<
46 typename tuples::element<N, tuples::cons<HT, TT> >::type
47 >::non_const_type
48get(tuples::cons<HT, TT>& c) {
49 return tuples::get<N,HT,TT>(c);
50}
51// get function for const cons-lists, returns a const reference to
52// the element. If the element is a reference, returns the reference
53// as such (that is, can return a non-const reference)
54template<int N, class HT, class TT>
55inline typename tuples::access_traits<
56 typename tuples::element<N, tuples::cons<HT, TT> >::type
57 >::const_type
58get(const tuples::cons<HT, TT>& c) {
59 return tuples::get<N,HT,TT>(c);
60}
61
62#endif // BOOST_NO_USING_TEMPLATE
63
64} // end namespace boost
65
66#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
67
68#include <tuple>
69#include <cstddef>
70
71namespace std
72{
73
74#if defined(BOOST_CLANG)
75# pragma clang diagnostic push
76# pragma clang diagnostic ignored "-Wmismatched-tags"
77#endif
78
79// std::tuple_size
80
81template<class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10>
82 class tuple_size< boost::tuples::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >:
83 public boost::tuples::length< boost::tuples::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
84{
85};
86
87template<class H, class T> class tuple_size< boost::tuples::cons<H, T> >:
88 public boost::tuples::length< boost::tuples::cons<H, T> >
89{
90};
91
92template<> class tuple_size< boost::tuples::null_type >:
93 public boost::tuples::length< boost::tuples::null_type >
94{
95};
96
97// std::tuple_element
98
99template<std::size_t I, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10>
100 class tuple_element< I, boost::tuples::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >:
101 public boost::tuples::element< I, boost::tuples::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> >
102{
103};
104
105template<std::size_t I, class H, class T> class tuple_element< I, boost::tuples::cons<H, T> >:
106 public boost::tuples::element< I, boost::tuples::cons<H, T> >
107{
108};
109
110#if defined(BOOST_CLANG)
111# pragma clang diagnostic pop
112#endif
113
114} // namespace std
115
116#endif // !defined(BOOST_NO_CXX11_HDR_TUPLE)
117
118#endif // BOOST_TUPLE_HPP
119

source code of include/boost/tuple/tuple.hpp