Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/tr1/array.hpp @ 44

Last change on this file since 44 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.9 KB
RevLine 
[29]1//  (C) Copyright John Maddock 2005.
2//  Use, modification and distribution are subject to the
3//  Boost Software License, Version 1.0. (See accompanying file
4//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6#ifndef BOOST_TR1_ARRAY_HPP_INCLUDED
7#  define BOOST_TR1_ARRAY_HPP_INCLUDED
8#  include <boost/tr1/detail/config.hpp>
9
10#ifdef BOOST_HAS_TR1_ARRAY
11
12#  include BOOST_TR1_HEADER(array)
13
14#else
15
16#include <boost/array.hpp>
17#include <boost/static_assert.hpp>
18#include <boost/type_traits/integral_constant.hpp>
19#include <boost/detail/workaround.hpp>
20
21namespace std{ namespace tr1{
22
23using ::boost::array;
24
25#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
26// [6.1.3.2] Tuple creation functions
27using ::boost::swap;
28#endif
29
30#if !defined(BOOST_TR1_USE_OLD_TUPLE)
31}} namespace boost{ namespace fusion{
32#endif
33
34// [6.2.2.5] Tuple interface to class template array
35template <class T> struct tuple_size; // forward declaration
36template <int I, class T> struct tuple_element; // forward declaration
37#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
38template <class T, size_t N>
39struct tuple_size< ::boost::array<T, N> >
40   : public ::boost::integral_constant< ::std::size_t, N>{};
41
42
43template <int I, class T, size_t N>
44struct tuple_element<I, ::boost::array<T, N> >
45{
46#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570))
47   BOOST_STATIC_ASSERT(I < (int)N);
48   BOOST_STATIC_ASSERT(I >= 0);
49#endif
50   typedef T type;
51};
52#endif
53template <int I, class T, size_t N>
54T& get( ::boost::array<T, N>& a)
55{
56   BOOST_STATIC_ASSERT(I < N);
57   BOOST_STATIC_ASSERT(I >= 0);
58   return a[I];
59}
60
61template <int I, class T, size_t N>
62const T& get(const array<T, N>& a)
63{
64   BOOST_STATIC_ASSERT(I < N);
65   BOOST_STATIC_ASSERT(I >= 0);
66   return a[I];
67}
68
69#if !defined(BOOST_TR1_USE_OLD_TUPLE)
70}} namespace std{ namespace tr1{
71
72   using ::boost::fusion::tuple_size;
73   using ::boost::fusion::tuple_element;
74   using ::boost::fusion::get;
75
76#endif
77
78
79} } // namespaces
80
81#endif
82
83#endif
Note: See TracBrowser for help on using the repository browser.