32#ifndef BOOST_ARRAY_HPP
33#define BOOST_ARRAY_HPP
35#include <boost/detail/workaround.hpp>
37#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
39# pragma warning(disable:4996)
40# pragma warning(disable:4510)
41# pragma warning(disable:4610)
47#include <boost/assert.hpp>
48#include <boost/static_assert.hpp>
49#include <boost/swap.hpp>
51#include <boost/throw_exception.hpp>
55#include <boost/config.hpp>
86 template<
class T, std::
size_t N>
267#if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
273#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
274 typedef std::reverse_iterator<
iterator, std::random_access_iterator_tag,
276 typedef std::reverse_iterator<
const_iterator, std::random_access_iterator_tag,
504 return BOOST_ASSERT_MSG( i < N,
"out of range" ),
elems[i];
543 return BOOST_ASSERT_MSG( i < N,
"out of range" ),
elems[i];
782 static BOOST_CONSTEXPR
bool empty() {
return false; }
809#ifndef BOOST_ARRAY_DOCS
811 enum { static_size = N };
962 template <
typename T2>
1045 return i >=
size() ? boost::throw_exception(std::out_of_range (
"array<>: index out of range")), true :
true;
1050#ifndef BOOST_ARRAY_DOCS
1053 class array< T, 0 > {
1075#if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
1078#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
1079 typedef std::reverse_iterator<
iterator, std::random_access_iterator_tag,
1081 typedef std::reverse_iterator<
const_iterator, std::random_access_iterator_tag,
1108 return failed_rangecheck();
1113 return failed_rangecheck();
1123 return failed_rangecheck();
1128 return failed_rangecheck();
1133 return failed_rangecheck();
1138 return failed_rangecheck();
1143 static BOOST_CONSTEXPR
bool empty() {
return true; }
1145 enum { static_size = 0 };
1147 void swap (array<T,0>& ) {
1151 const T*
data()
const {
return 0; }
1152 T*
data() {
return 0; }
1158 template <
typename T2>
1159 array<T,0>&
operator= (
const array<T2,0>& ) {
1164 void assign (
const T& value) {
fill ( value ); }
1165 void fill (
const T& ) {}
1169 std::out_of_range e(
"attempt to access element of an empty array");
1170 boost::throw_exception(e);
1171#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__))
1177 static T placeholder;
1205 template<
class T, std::
size_t N>
1207 return std::equal(x.begin(), x.end(), y.begin());
1229 template<
class T, std::
size_t N>
1231 return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
1253 template<
class T, std::
size_t N>
1277 template<
class T, std::
size_t N>
1301 template<
class T, std::
size_t N>
1325 template<
class T, std::
size_t N>
1353 template<
class T, std::
size_t N>
1358#if defined(__SUNPRO_CC)
1365 template <
typename T, std::
size_t N>
struct c_array
1372 template <
typename T, std::
size_t N>
1379 template <
typename T, std::
size_t N>
1386 template <
typename T, std::
size_t N>
1393 template <
typename T, std::
size_t N>
1404 template <
typename T, std::
size_t N>
1407 return static_cast<T(&)[N]
>(arg);
1411 template <
typename T, std::
size_t N>
1412 const T(&
get_c_array(
const std::array<T,N>& arg))[N]
1414 return static_cast<T(&)[N]
>(arg);
1464 template<
class T, std::
size_t N>
1500 template <
size_t Idx,
typename T,
size_t N>
1502 BOOST_STATIC_ASSERT_MSG ( Idx < N,
"boost::get<>(boost::array &) index out of range" );
1537 template <
size_t Idx,
typename T,
size_t N>
1539 BOOST_STATIC_ASSERT_MSG ( Idx < N,
"boost::get<>(const boost::array &) index out of range" );
1545#ifndef BOOST_NO_CXX11_HDR_ARRAY
1548 template <
size_t Idx,
typename T,
size_t N>
1550 BOOST_STATIC_ASSERT_MSG ( Idx < N,
"std::get<>(boost::array &) index out of range" );
1554 template <
size_t Idx,
typename T,
size_t N>
1556 BOOST_STATIC_ASSERT_MSG ( Idx < N,
"std::get<>(const boost::array &) index out of range" );
1562#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
1563# pragma warning(pop)
A container that encapsulates fixed size arrays.
Definition: array.hpp:87
T value_type
The array value type.
Definition: array.hpp:97
T elems[N]
Underlying fixed-size array of elements of type T.
Definition: array.hpp:90
static constexpr size_type size()
Returns the number of elements.
Definition: array.hpp:761
const_reverse_iterator rend() const
Returns a constant reverse iterator to the end.
Definition: array.hpp:428
constexpr const_reference back() const
Access the last array element.
Definition: array.hpp:733
reference back()
Access the last array element.
Definition: array.hpp:700
reverse_iterator rbegin()
Returns a reverse iterator to the beginning.
Definition: array.hpp:311
const_reverse_iterator rbegin() const
Returns a constant reverse iterator to the beginning.
Definition: array.hpp:338
std::size_t size_type
Type used to represent array size.
Definition: array.hpp:112
reverse_iterator rend()
Returns a reverse iterator to the end.
Definition: array.hpp:398
void swap(array< T, N > &y)
Swaps the container contents.
Definition: array.hpp:842
const_reference operator[](size_type i) const
Access specified element.
Definition: array.hpp:541
void assign(const T &value)
Assign one value to all elements.
Definition: array.hpp:989
static constexpr bool rangecheck(size_type i)
Check range.
Definition: array.hpp:1044
void fill(const T &value)
Assign one value to all elements.
Definition: array.hpp:1010
static constexpr bool empty()
Checks whether the container is empty.
Definition: array.hpp:782
reference front()
Access the first array element.
Definition: array.hpp:636
T * data()
Direct access to the underlying array.
Definition: array.hpp:909
iterator begin()
Returns an iterator to the beginning.
Definition: array.hpp:140
const T * data() const
Direct access to the underlying array.
Definition: array.hpp:880
reference operator[](size_type i)
Access specified element.
Definition: array.hpp:502
const T & const_reference
Constant reference to value type.
Definition: array.hpp:109
const_reverse_iterator crend() const
Returns a constant reverse iterator to the end.
Definition: array.hpp:462
iterator end()
Returns an iterator to the end.
Definition: array.hpp:211
const_reference at(size_type i) const
Access specified element with bounds checking.
Definition: array.hpp:608
T * iterator
Iterator to C-style array, i.e. a pointer.
Definition: array.hpp:100
const T * const_iterator
Constant iterator to array, i.e. a pointer.
Definition: array.hpp:103
const_reverse_iterator crbegin() const
Returns a reverse iterator to the beginning.
Definition: array.hpp:368
array< T, N > & operator=(const array< T2, N > &rhs)
Overwrites element of the array with elements of another array.
Definition: array.hpp:963
std::reverse_iterator< iterator > reverse_iterator
Reverse array iterator - std::reverse_iterator<iterator>
Definition: array.hpp:269
const_iterator end() const
Returns a constant iterator to the end.
Definition: array.hpp:235
reference at(size_type i)
Access specified element with bounds checking.
Definition: array.hpp:575
std::reverse_iterator< const_iterator > const_reverse_iterator
Constant reverse array iterator - std::reverse_iterator<const_iterator>
Definition: array.hpp:272
static constexpr size_type max_size()
Returns the maximum possible number of elements.
Definition: array.hpp:805
const_iterator begin() const
Returns a constant iterator to the beginning.
Definition: array.hpp:163
std::ptrdiff_t difference_type
Type used to represent distance between iterators.
Definition: array.hpp:115
const_iterator cend() const
Returns a constant iterator to the end.
Definition: array.hpp:260
const_iterator cbegin() const
Returns a constant iterator to the beginning.
Definition: array.hpp:188
T & reference
Reference to value type.
Definition: array.hpp:106
constexpr const_reference front() const
Access the first array element.
Definition: array.hpp:669
T * c_array()
Direct access to the underlying array.
Definition: array.hpp:940
bool operator<=(const array< T, N > &x, const array< T, N > &y)
Lexicographically compares the values in the array (operator<=)
Definition: array.hpp:1302
std::size_t hash_range(It, It)
Calculate combined hash value of the elements of an iterator range.
std::size_t hash_value(const array< T, N > &arr)
Calculate hash value for an array.
Definition: array.hpp:1465
bool operator==(const array< T, N > &x, const array< T, N > &y)
Lexicographically compares the values in the array (.
Definition: array.hpp:1206
void swap(array< T, N > &x, array< T, N > &y)
Global swap function.
Definition: array.hpp:1354
T & get(boost::array< T, N > &arr) noexcept
Extracts the Ith element from the array.
Definition: array.hpp:1501
T(& get_c_array(boost::array< T, N > &arg))[N]
Definition: array.hpp:1387
bool operator>(const array< T, N > &x, const array< T, N > &y)
Lexicographically compares the values in the array (operator>)
Definition: array.hpp:1278
bool operator!=(const array< T, N > &x, const array< T, N > &y)
Lexicographically compares the values in the array (operator!=)
Definition: array.hpp:1254
bool operator<(const array< T, N > &x, const array< T, N > &y)
Lexicographically compares the values in the array (operator<)
Definition: array.hpp:1230
bool operator>=(const array< T, N > &x, const array< T, N > &y)
Lexicographically compares the values in the array (operator>=)
Definition: array.hpp:1326
Definition: array.hpp:1547
T & get(boost::array< T, N > &arr) noexcept
Definition: array.hpp:1549