First public contribution.
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 # include BOOST_TR1_HEADER(array)
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>
21 namespace std{ namespace tr1{
25 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582)
26 // [6.1.3.2] Tuple creation functions
30 #if !defined(BOOST_TR1_USE_OLD_TUPLE)
31 }} namespace boost{ namespace fusion{
34 // [6.2.2.5] Tuple interface to class template array
35 template <class T> struct tuple_size; // forward declaration
36 template <int I, class T> struct tuple_element; // forward declaration
37 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
38 template <class T, size_t N>
39 struct tuple_size< ::boost::array<T, N> >
40 : public ::boost::integral_constant< ::std::size_t, N>{};
43 template <int I, class T, size_t N>
44 struct tuple_element<I, ::boost::array<T, N> >
46 #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570))
47 BOOST_STATIC_ASSERT(I < (int)N);
48 BOOST_STATIC_ASSERT(I >= 0);
53 template <int I, class T, size_t N>
54 T& get( ::boost::array<T, N>& a)
56 BOOST_STATIC_ASSERT(I < N);
57 BOOST_STATIC_ASSERT(I >= 0);
61 template <int I, class T, size_t N>
62 const T& get(const array<T, N>& a)
64 BOOST_STATIC_ASSERT(I < N);
65 BOOST_STATIC_ASSERT(I >= 0);
69 #if !defined(BOOST_TR1_USE_OLD_TUPLE)
70 }} namespace std{ namespace tr1{
72 using ::boost::fusion::tuple_size;
73 using ::boost::fusion::tuple_element;
74 using ::boost::fusion::get;