fix doc example typo
[boost.git] / boost / tr1 / array.hpp
blob485712a8fa20d8254b33883a22d2b05176a7af7a
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)
6 #ifndef BOOST_TR1_ARRAY_HPP_INCLUDED
7 # define BOOST_TR1_ARRAY_HPP_INCLUDED
8 # include <boost/tr1/detail/config.hpp>
10 #ifdef BOOST_HAS_TR1_ARRAY
12 # ifdef BOOST_HAS_INCLUDE_NEXT
13 # include_next BOOST_TR1_HEADER(array)
14 # else
15 # include <boost/tr1/detail/config_all.hpp>
16 # include BOOST_TR1_STD_HEADER(BOOST_TR1_PATH(array))
17 # endif
19 #else
21 #include <boost/array.hpp>
22 #include <boost/static_assert.hpp>
23 #include <boost/type_traits/integral_constant.hpp>
24 #include <boost/detail/workaround.hpp>
26 namespace std{ namespace tr1{
28 using ::boost::array;
30 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
31 // [6.1.3.2] Tuple creation functions
32 using ::boost::swap;
33 #endif
35 #if !defined(BOOST_TR1_USE_OLD_TUPLE)
36 }} namespace boost{ namespace fusion{
37 #endif
39 // [6.2.2.5] Tuple interface to class template array
40 template <class T> struct tuple_size; // forward declaration
41 template <int I, class T> struct tuple_element; // forward declaration
42 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
43 template <class T, size_t N>
44 struct tuple_size< ::boost::array<T, N> >
45 : public ::boost::integral_constant< ::std::size_t, N>{};
48 template <int I, class T, size_t N>
49 struct tuple_element<I, ::boost::array<T, N> >
51 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570))
52 BOOST_STATIC_ASSERT(I < (int)N);
53 BOOST_STATIC_ASSERT(I >= 0);
54 #endif
55 typedef T type;
57 #endif
58 template <int I, class T, size_t N>
59 T& get( ::boost::array<T, N>& a)
61 BOOST_STATIC_ASSERT(I < N);
62 BOOST_STATIC_ASSERT(I >= 0);
63 return a[I];
66 template <int I, class T, size_t N>
67 const T& get(const array<T, N>& a)
69 BOOST_STATIC_ASSERT(I < N);
70 BOOST_STATIC_ASSERT(I >= 0);
71 return a[I];
74 #if !defined(BOOST_TR1_USE_OLD_TUPLE)
75 }} namespace std{ namespace tr1{
77 using ::boost::fusion::tuple_size;
78 using ::boost::fusion::tuple_element;
79 using ::boost::fusion::get;
81 #endif
84 } } // namespaces
86 #endif
88 #endif