]> git.lyx.org Git - lyx.git/blob - boost/boost/tuple/tuple.hpp
update
[lyx.git] / boost / boost / tuple / tuple.hpp
1 //  tuple.hpp - Boost Tuple Library --------------------------------------
2
3 // Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
4 //
5 // Permission to copy, use, sell and distribute this software is granted
6 // provided this copyright notice appears in all copies. 
7 // Permission to modify the code and to distribute modified code is granted
8 // provided this copyright notice appears in all copies, and a notice 
9 // that the code was modified is included with the copyright notice.
10 //
11 // This software is provided "as is" without express or implied warranty, 
12 // and with no claim as to its suitability for any purpose.
13
14 // For more information, see http://www.boost.org
15
16 // ----------------------------------------------------------------- 
17
18 #ifndef BOOST_TUPLE_HPP
19 #define BOOST_TUPLE_HPP
20
21 #include "boost/config.hpp"
22 #include "boost/static_assert.hpp"
23
24 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
25 // The MSVC version
26 #include "boost/tuple/detail/tuple_basic_no_partial_spec.hpp"
27
28 #else
29 // other compilers
30 #include "boost/ref.hpp"
31 #include "boost/tuple/detail/tuple_basic.hpp"
32
33 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
34
35 namespace boost {    
36
37 using tuples::tuple;
38 using tuples::make_tuple;
39 using tuples::tie;
40 #if !defined(BOOST_NO_USING_TEMPLATE)
41 using tuples::get;
42 #elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
43 //
44 // The "using tuples::get" statement causes the
45 // Borland compiler to ICE, use forwarding
46 // functions instead:
47 //
48 template<int N, class HT, class TT>
49 inline typename tuples::access_traits<
50                   typename tuples::element<N, tuples::cons<HT, TT> >::type
51                 >::non_const_type
52 get(tuples::cons<HT, TT>& c) {
53   return tuples::get<N,HT,TT>(c);
54
55 // get function for const cons-lists, returns a const reference to
56 // the element. If the element is a reference, returns the reference
57 // as such (that is, can return a non-const reference)
58 template<int N, class HT, class TT>
59 inline typename tuples::access_traits<
60                   typename tuples::element<N, tuples::cons<HT, TT> >::type
61                 >::const_type
62 get(const tuples::cons<HT, TT>& c) {
63   return tuples::get<N,HT,TT>(c);
64 }
65 #else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
66 //
67 // MSVC, using declarations don't mix with templates well,
68 // so use forwarding functions instead:
69 //
70 template<int N, typename Head, typename Tail>
71 typename tuples::detail::element_ref<N, tuples::cons<Head, Tail> >::RET
72 get(tuples::cons<Head, Tail>& t, tuples::detail::workaround_holder<N>* = 0)
73 {
74    return tuples::detail::get_class<N>::get(t);
75 }
76
77 template<int N, typename Head, typename Tail>
78 typename tuples::detail::element_const_ref<N, tuples::cons<Head, Tail> >::RET
79 get(const tuples::cons<Head, Tail>& t, tuples::detail::workaround_holder<N>* = 0)
80 {
81    return tuples::detail::get_class<N>::get(t);
82 }
83 #endif // BOOST_NO_USING_TEMPLATE
84    
85 } // end namespace boost
86
87
88 #endif // BOOST_TUPLE_HPP