Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class template array

boost::array — STL compliant container wrapper for arrays of constant size

Synopsis

// In header: <boost/array.hpp>

template<typename T,  N> 
class array {
public:
  // types
  typedef                                      ;            
  typedef                                     ;              
  typedef                               ;        
  typedef std::reverse_iterator<       ;      
  typedef std::reverse_iterator< ;
  typedef                                     ;             
  typedef                               ;       
  typedef                            ;             
  typedef                         ;       

  // static constants
    = ;

  // construct/copy/destruct
  template<typename U> array& (array<);

  // iterator support
   ();
   () ;
   ();
   () ;
   ();
   ();

  // reverse iterator support
   ();
   () ;
   ();
   () ;
   ();
   ();

  // capacity
   ();
   ();
   ();

  // element access
   ();
   () ;
   ();
   () ;
   ();
   () ;
   ();
   () ;
   () ;
   ();

  // modifiers
   (array<);
   ();

  // public data members
   elems[N];
};

// specialized algorithms
template<typename T,  N>  (array<, array<);

// comparisons
template<typename T,  N> 
   (array<, array<);
template<typename T,  N> 
   (array<, array<);
template<typename T,  N> 
   (array<, array<);
template<typename T,  N> 
   (array<, array<);
template<typename T,  N> 
   (array<, array<);
template<typename T,  N> 
   (array<, array<);

// specializations
template<typename T,  N,  Idx> 
   (array<);
template<typename T,  N,  Idx> 
   (array<);

Description

array public construct/copy/destruct

  1. template<typename U> array& (array< other);

    Effects:

    std::copy(rhs.begin(),rhs.end(), begin())

array iterator support

  1.  ();
     () ;

    Returns:

    iterator for the first element

    Throws:

    will not throw
  2.  ();
     () ;

    Returns:

    iterator for position after the last element

    Throws:

    will not throw
  3.  ();

    Returns:

    constant iterator for the first element

    Throws:

    will not throw
  4.  ();

    Returns:

    constant iterator for position after the last element

    Throws:

    will not throw

array reverse iterator support

  1.  ();
     () ;

    Returns:

    reverse iterator for the first element of reverse iteration
  2.  ();
     () ;

    Returns:

    reverse iterator for position after the last element in reverse iteration
  3.  ();

    Returns:

    constant reverse iterator for the first element of reverse iteration

    Throws:

    will not throw
  4.  ();

    Returns:

    constant reverse iterator for position after the last element in reverse iteration

    Throws:

    will not throw

array capacity

  1.  ();

    Returns:

    N
  2.  ();

    Returns:

    N==0

    Throws:

    will not throw
  3.  ();

    Returns:

    N

    Throws:

    will not throw

array element access

  1.  ( i);
     ( i) ;

    Requires:

    i < N

    Returns:

    element with index i

    Throws:

    will not throw.
  2.  ( i);
     ( i) ;

    Returns:

    element with index i

    Throws:

    std::range_error if i >= N
  3.  ();
     () ;

    Requires:

    N > 0

    Returns:

    the first element

    Throws:

    will not throw
  4.  ();
     () ;

    Requires:

    N > 0

    Returns:

    the last element

    Throws:

    will not throw
  5.  () ;

    Returns:

    elems

    Throws:

    will not throw
  6.  ();

    Returns:

    elems

    Throws:

    will not throw

array modifiers

  1.  (array< other);

    Effects:

    std::swap_ranges(begin(), end(), other.begin())

    Complexity:

    linear in N
  2.  ( value);

    Effects:

    std::fill_n(begin(), N, value)

array specialized algorithms

  1. template<typename T,  N>  (array< x, array< y);

    Effects:

    x.swap(y)

    Throws:

    will not throw.

array comparisons

  1. template<typename T,  N> 
       (array< x, array< y);

    Returns:

    std::equal(x.begin(), x.end(), y.begin())
  2. template<typename T,  N> 
       (array< x, array< y);

    Returns:

    !(x == y)
  3. template<typename T,  N> 
       (array< x, array< y);

    Returns:

    std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end())
  4. template<typename T,  N> 
       (array< x, array< y);

    Returns:

    y < x
  5. template<typename T,  N> 
       (array< x, array< y);

    Returns:

    !(y < x)
  6. template<typename T,  N> 
       (array< x, array< y);

    Returns:

    !(x < y)

array specializations

  1. template<typename T,  N,  Idx> 
       (array< arr);

    Returns:

    element of array with index Idx

    Effects:

    Will static_assert if Idx >= N
  2. template<typename T,  N,  Idx> 
       (array< arr);

    Returns:

    const element of array with index Idx

    Effects:

    Will static_assert if Idx >= N

PrevUpHomeNext