Chris@16
|
1 // tuple.hpp - Boost Tuple Library --------------------------------------
|
Chris@16
|
2
|
Chris@16
|
3 // Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
Chris@16
|
4 //
|
Chris@16
|
5 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
6 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 // For more information, see http://www.boost.org
|
Chris@16
|
10
|
Chris@16
|
11 // -----------------------------------------------------------------
|
Chris@16
|
12
|
Chris@16
|
13 #ifndef BOOST_TUPLE_HPP
|
Chris@16
|
14 #define BOOST_TUPLE_HPP
|
Chris@16
|
15
|
Chris@16
|
16 #if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730
|
Chris@16
|
17 // Work around a compiler bug.
|
Chris@16
|
18 // boost::python::tuple has to be seen by the compiler before the
|
Chris@16
|
19 // boost::tuple class template.
|
Chris@16
|
20 namespace boost { namespace python { class tuple; }}
|
Chris@16
|
21 #endif
|
Chris@16
|
22
|
Chris@16
|
23 #include "boost/config.hpp"
|
Chris@16
|
24 #include "boost/static_assert.hpp"
|
Chris@16
|
25
|
Chris@16
|
26 // other compilers
|
Chris@16
|
27 #include "boost/ref.hpp"
|
Chris@16
|
28 #include "boost/tuple/detail/tuple_basic.hpp"
|
Chris@16
|
29
|
Chris@16
|
30
|
Chris@16
|
31 namespace boost {
|
Chris@16
|
32
|
Chris@16
|
33 using tuples::tuple;
|
Chris@16
|
34 using tuples::make_tuple;
|
Chris@16
|
35 using tuples::tie;
|
Chris@16
|
36 #if !defined(BOOST_NO_USING_TEMPLATE)
|
Chris@16
|
37 using tuples::get;
|
Chris@101
|
38 #else
|
Chris@16
|
39 //
|
Chris@16
|
40 // The "using tuples::get" statement causes the
|
Chris@16
|
41 // Borland compiler to ICE, use forwarding
|
Chris@16
|
42 // functions instead:
|
Chris@16
|
43 //
|
Chris@16
|
44 template<int N, class HT, class TT>
|
Chris@16
|
45 inline typename tuples::access_traits<
|
Chris@16
|
46 typename tuples::element<N, tuples::cons<HT, TT> >::type
|
Chris@16
|
47 >::non_const_type
|
Chris@16
|
48 get(tuples::cons<HT, TT>& c) {
|
Chris@16
|
49 return tuples::get<N,HT,TT>(c);
|
Chris@16
|
50 }
|
Chris@16
|
51 // get function for const cons-lists, returns a const reference to
|
Chris@16
|
52 // the element. If the element is a reference, returns the reference
|
Chris@16
|
53 // as such (that is, can return a non-const reference)
|
Chris@16
|
54 template<int N, class HT, class TT>
|
Chris@16
|
55 inline typename tuples::access_traits<
|
Chris@16
|
56 typename tuples::element<N, tuples::cons<HT, TT> >::type
|
Chris@16
|
57 >::const_type
|
Chris@16
|
58 get(const tuples::cons<HT, TT>& c) {
|
Chris@16
|
59 return tuples::get<N,HT,TT>(c);
|
Chris@16
|
60 }
|
Chris@16
|
61
|
Chris@16
|
62 #endif // BOOST_NO_USING_TEMPLATE
|
Chris@16
|
63
|
Chris@16
|
64 } // end namespace boost
|
Chris@16
|
65
|
Chris@16
|
66
|
Chris@16
|
67 #endif // BOOST_TUPLE_HPP
|