imgtools/imglib/boostlibrary/boost/tr1/utility.hpp
author srilekhas <srilekhas@symbian.org>
Wed, 18 Aug 2010 11:18:38 +0100
changeset 627 cb3264f4c6e6
parent 600 6d08f4a05d93
permissions -rw-r--r--
Merge : re-applies missing part of fix for Bug 2901,Add export for s60ibymacros.pm
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
//  (C) Copyright John Maddock 2005.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
//  Use, modification and distribution are subject to the
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
//  Boost Software License, Version 1.0. (See accompanying file
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
#ifndef BOOST_TR1_UTILITY_HPP_INCLUDED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
#  define BOOST_TR1_UTILITY_HPP_INCLUDED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
#  include <boost/tr1/detail/config.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
#ifdef BOOST_HAS_TR1_UTILITY
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
#  ifdef BOOST_HAS_INCLUDE_NEXT
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
#     include_next BOOST_TR1_HEADER(utility)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
#  else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
#     include <boost/tr1/detail/config_all.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
#     include BOOST_TR1_STD_HEADER(BOOST_TR1_PATH(utility))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
#  endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
#if defined(BOOST_TR1_USE_OLD_TUPLE)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
#include <boost/type_traits/integral_constant.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
#include <boost/type_traits/add_const.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
#include <boost/type_traits/add_reference.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
#include <boost/mpl/if.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
namespace std{ namespace tr1{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
template <class T> struct tuple_size; // forward declaration
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
template < int I, class T> struct tuple_element; // forward declaration
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
template <class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
struct tuple_size< ::std::pair<T1, T2> >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
   : public ::boost::integral_constant< ::std::size_t, 2>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
template <class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
struct tuple_element<0, ::std::pair<T1, T2> >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
   typedef typename std::pair<T1, T2>::first_type type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
template <class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
struct tuple_element<1, std::pair<T1, T2> >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
   typedef typename std::pair<T1, T2>::second_type type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
namespace tuple_detail{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
   template <int I, class T1, class T2>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
   struct tuple_get_result
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
   {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
      typedef typename boost::mpl::if_c<I==0, T1, T2>::type t1;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
      typedef typename boost::add_reference<t1>::type type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
   };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
   template <int I, class T1, class T2>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
   struct const_tuple_get_result
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
   {
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
      typedef typename boost::mpl::if_c<I==0, T1, T2>::type t1;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
# if BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x582))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    66
      // I have absolutely no idea why add_const is not working here for Borland!
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    67
      // It passes all other free-standing tests, some strange interaction going on
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    68
      typedef typename boost::add_reference< const t1 >::type type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    69
# else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    70
      typedef typename boost::add_const<t1>::type t2;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    71
      typedef typename boost::add_reference<t2>::type type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    72
# endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    73
   };
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    74
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    75
template<int I, class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    76
inline typename tuple_detail::tuple_get_result<I,T1,T2>::type get(std::pair<T1, T2>& p, const ::boost::true_type&)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    77
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    78
   return p.first;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    79
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    80
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    81
template<int I, class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    82
inline typename tuple_detail::const_tuple_get_result<I,T1,T2>::type get(const std::pair<T1, T2>& p, const ::boost::true_type&)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    83
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    84
   return p.first;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    85
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    86
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    87
template<int I, class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    88
inline typename tuple_detail::tuple_get_result<I,T1,T2>::type get(std::pair<T1, T2>& p, const ::boost::false_type&)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    89
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    90
   return p.second;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    91
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    92
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    93
template<int I, class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    94
inline typename tuple_detail::const_tuple_get_result<I,T1,T2>::type get(const std::pair<T1, T2>& p, const ::boost::false_type&)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    95
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    96
   return p.second;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    97
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    98
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    99
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   100
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   101
template<int I, class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   102
inline typename tuple_detail::tuple_get_result<I,T1,T2>::type get(std::pair<T1, T2>& p)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   103
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   104
   return tuple_detail::get<I>(p, boost::integral_constant<bool, I==0>());
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   105
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   106
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   107
template<int I, class T1, class T2> 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   108
inline typename tuple_detail::const_tuple_get_result<I,T1,T2>::type get(const std::pair<T1, T2>& p)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   109
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   110
   return tuple_detail::get<I>(p, boost::integral_constant<bool, I==0>());
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   111
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   112
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   113
} } // namespaces
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   114
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   115
#else
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   116
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   117
#include <boost/tr1/tuple.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   118
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   119
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   120
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   121
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   122
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   123
#endif