epoc32/include/stdapis/boost/tuple/tuple.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
//  tuple.hpp - Boost Tuple Library --------------------------------------
williamr@2
     2
williamr@2
     3
// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
williamr@2
     4
//
williamr@2
     5
// Distributed under the Boost Software License, Version 1.0. (See
williamr@2
     6
// accompanying file LICENSE_1_0.txt or copy at
williamr@2
     7
// http://www.boost.org/LICENSE_1_0.txt)
williamr@2
     8
williamr@2
     9
// For more information, see http://www.boost.org
williamr@2
    10
williamr@2
    11
// ----------------------------------------------------------------- 
williamr@2
    12
williamr@2
    13
#ifndef BOOST_TUPLE_HPP
williamr@2
    14
#define BOOST_TUPLE_HPP
williamr@2
    15
williamr@2
    16
#if defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730
williamr@2
    17
// Work around a compiler bug.
williamr@2
    18
// boost::python::tuple has to be seen by the compiler before the
williamr@2
    19
// boost::tuple class template.
williamr@2
    20
namespace boost { namespace python { class tuple; }}
williamr@2
    21
#endif
williamr@2
    22
williamr@2
    23
#include "boost/config.hpp"
williamr@2
    24
#include "boost/static_assert.hpp"
williamr@2
    25
williamr@2
    26
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
williamr@2
    27
// The MSVC version
williamr@2
    28
#include "boost/tuple/detail/tuple_basic_no_partial_spec.hpp"
williamr@2
    29
williamr@2
    30
#else
williamr@2
    31
// other compilers
williamr@2
    32
#include "boost/ref.hpp"
williamr@2
    33
#include "boost/tuple/detail/tuple_basic.hpp"
williamr@2
    34
williamr@2
    35
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
williamr@2
    36
williamr@2
    37
namespace boost {    
williamr@2
    38
williamr@2
    39
using tuples::tuple;
williamr@2
    40
using tuples::make_tuple;
williamr@2
    41
using tuples::tie;
williamr@2
    42
#if !defined(BOOST_NO_USING_TEMPLATE)
williamr@2
    43
using tuples::get;
williamr@2
    44
#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
williamr@2
    45
//
williamr@2
    46
// The "using tuples::get" statement causes the
williamr@2
    47
// Borland compiler to ICE, use forwarding
williamr@2
    48
// functions instead:
williamr@2
    49
//
williamr@2
    50
template<int N, class HT, class TT>
williamr@2
    51
inline typename tuples::access_traits<
williamr@2
    52
                  typename tuples::element<N, tuples::cons<HT, TT> >::type
williamr@2
    53
                >::non_const_type
williamr@2
    54
get(tuples::cons<HT, TT>& c) {
williamr@2
    55
  return tuples::get<N,HT,TT>(c);
williamr@2
    56
} 
williamr@2
    57
// get function for const cons-lists, returns a const reference to
williamr@2
    58
// the element. If the element is a reference, returns the reference
williamr@2
    59
// as such (that is, can return a non-const reference)
williamr@2
    60
template<int N, class HT, class TT>
williamr@2
    61
inline typename tuples::access_traits<
williamr@2
    62
                  typename tuples::element<N, tuples::cons<HT, TT> >::type
williamr@2
    63
                >::const_type
williamr@2
    64
get(const tuples::cons<HT, TT>& c) {
williamr@2
    65
  return tuples::get<N,HT,TT>(c);
williamr@2
    66
}
williamr@2
    67
#else  // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
williamr@2
    68
//
williamr@2
    69
// MSVC, using declarations don't mix with templates well,
williamr@2
    70
// so use forwarding functions instead:
williamr@2
    71
//
williamr@2
    72
template<int N, typename Head, typename Tail>
williamr@2
    73
typename tuples::detail::element_ref<N, tuples::cons<Head, Tail> >::RET
williamr@2
    74
get(tuples::cons<Head, Tail>& t, tuples::detail::workaround_holder<N>* = 0)
williamr@2
    75
{
williamr@2
    76
   return tuples::detail::get_class<N>::get(t);
williamr@2
    77
}
williamr@2
    78
williamr@2
    79
template<int N, typename Head, typename Tail>
williamr@2
    80
typename tuples::detail::element_const_ref<N, tuples::cons<Head, Tail> >::RET
williamr@2
    81
get(const tuples::cons<Head, Tail>& t, tuples::detail::workaround_holder<N>* = 0)
williamr@2
    82
{
williamr@2
    83
   return tuples::detail::get_class<N>::get(t);
williamr@2
    84
}
williamr@2
    85
#endif // BOOST_NO_USING_TEMPLATE
williamr@2
    86
   
williamr@2
    87
} // end namespace boost
williamr@2
    88
williamr@2
    89
williamr@2
    90
#endif // BOOST_TUPLE_HPP