imgtools/imglib/boostlibrary/boost/tr1/array.hpp
author jjkang
Tue, 29 Jun 2010 14:52:54 +0800
changeset 606 30b30f9da0b7
parent 600 6d08f4a05d93
permissions -rw-r--r--
Add ..\dev\.. to path
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_ARRAY_HPP_INCLUDED
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
#  define BOOST_TR1_ARRAY_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_ARRAY
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(array)
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(array))
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
#include <boost/array.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
#include <boost/static_assert.hpp>
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/detail/workaround.hpp>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
namespace std{ namespace tr1{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
using ::boost::array;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
// [6.1.3.2] Tuple creation functions
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
using ::boost::swap;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
#if !defined(BOOST_TR1_USE_OLD_TUPLE)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
}} namespace boost{ namespace fusion{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
// [6.2.2.5] Tuple interface to class template array
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
template <class T> struct tuple_size; // forward declaration
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
template <int I, class T> struct tuple_element; // forward declaration
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
template <class T, size_t N>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
struct tuple_size< ::boost::array<T, N> >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
   : public ::boost::integral_constant< ::std::size_t, N>{};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
template <int I, class T, size_t N>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
struct tuple_element<I, ::boost::array<T, N> >
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570))
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
   BOOST_STATIC_ASSERT(I < (int)N);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
   BOOST_STATIC_ASSERT(I >= 0);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
   typedef T type;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
};
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
template <int I, class T, size_t N>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
T& get( ::boost::array<T, N>& a)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
   BOOST_STATIC_ASSERT(I < N);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
   BOOST_STATIC_ASSERT(I >= 0);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
   return a[I];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    66
template <int I, class T, size_t N>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    67
const T& get(const array<T, N>& a)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    68
{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    69
   BOOST_STATIC_ASSERT(I < N);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    70
   BOOST_STATIC_ASSERT(I >= 0);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    71
   return a[I];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    72
}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    73
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    74
#if !defined(BOOST_TR1_USE_OLD_TUPLE)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    75
}} namespace std{ namespace tr1{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    76
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    77
   using ::boost::fusion::tuple_size;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    78
   using ::boost::fusion::tuple_element;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    79
   using ::boost::fusion::get;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    80
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    81
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    82
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    83
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    84
} } // namespaces
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    85
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    86
#endif
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    87
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    88
#endif