Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::container::static_vector< Value, Capacity > Class Template Reference

A variable-size array container with fixed capacity. More...

#include <static_vector.hpp>

Inheritance diagram for boost::container::static_vector< Value, Capacity >:
Collaboration diagram for boost::container::static_vector< Value, Capacity >:

Public Types

typedef base_t::value_type value_type
 The type of elements stored in the container. More...
 
typedef base_t::size_type size_type
 The unsigned integral type used by the container. More...
 
typedef base_t::difference_type difference_type
 The pointers difference type. More...
 
typedef base_t::pointer pointer
 The pointer type. More...
 
typedef base_t::const_pointer const_pointer
 The const pointer type. More...
 
typedef base_t::reference reference
 The value reference type. More...
 
typedef base_t::const_reference const_reference
 The value const reference type. More...
 
typedef base_t::iterator iterator
 The iterator type. More...
 
typedef base_t::const_iterator const_iterator
 The const iterator type. More...
 
typedef base_t::reverse_iterator reverse_iterator
 The reverse iterator type. More...
 
typedef
base_t::const_reverse_iterator 
const_reverse_iterator
 The const reverse iterator. More...
 
typedef Allocator allocator_type
 
typedef Allocator stored_allocator_type
 

Public Member Functions

 static_vector () BOOST_CONTAINER_NOEXCEPT
 Constructs an empty static_vector. More...
 
 static_vector (size_type count)
 Constructs a static_vector containing count value initialized values. More...
 
 static_vector (size_type count, default_init_t)
 Constructs a static_vector containing count default initialized values. More...
 
 static_vector (size_type count, value_type const &value)
 Constructs a static_vector containing count copies of value. More...
 
template<typename Iterator >
 static_vector (Iterator first, Iterator last)
 Constructs a static_vector containing copy of a range [first, last). More...
 
 static_vector (std::initializer_list< value_type > il)
 Constructs a static_vector containing copy of a range [il.begin(), il.end()). More...
 
 static_vector (static_vector const &other)
 Constructs a copy of other static_vector. More...
 
template<std::size_t C>
 static_vector (static_vector< value_type, C > const &other)
 Constructs a copy of other static_vector. More...
 
 static_vector (BOOST_RV_REF(static_vector) other)
 Move constructor. More...
 
template<std::size_t C>
 static_vector (BOOST_RV_REF_BEG static_vector< value_type, C > BOOST_RV_REF_END other)
 Move constructor. Moves Values stored in the other static_vector to this one. More...
 
static_vectoroperator= (BOOST_COPY_ASSIGN_REF(static_vector) other)
 Copy assigns Values stored in the other static_vector to this one. More...
 
static_vectoroperator= (std::initializer_list< value_type > il)
 Copy assigns Values stored in std::initializer_list to *this. More...
 
template<std::size_t C>
static_vectoroperator= (static_vector< value_type, C > const &other)
 Copy assigns Values stored in the other static_vector to this one. More...
 
static_vectoroperator= (BOOST_RV_REF(static_vector) other)
 Move assignment. More...
 
template<std::size_t C>
static_vectoroperator= (BOOST_RV_REF_BEG static_vector< value_type, C > BOOST_RV_REF_END other)
 Move assignment. Moves Values stored in the other static_vector to this one. More...
 
typedef BOOST_CONTAINER_IMPDEF (iterator_impl) iterator
 
typedef BOOST_CONTAINER_IMPDEF (const_iterator_impl) const _iterator
 
typedef BOOST_CONTAINER_IMPDEF (container_detail::reverse_iterator< iterator >) reverse_iterator
 
typedef BOOST_CONTAINER_IMPDEF (container_detail::reverse_iterator< const_iterator >) const _reverse_iterator
 
void assign (InIt first, InIt last BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c< !container_detail::is_convertible< InIt BOOST_CONTAINER_I size_type >::value &&(container_detail::is_input_iterator< InIt >::value||container_detail::is_same< alloc_version BOOST_CONTAINER_I allocator_v0 >::value) >::type *=0))
 Effects: Assigns the the range [first, last) to *this. More...
 
void assign (std::initializer_list< Value > il)
 Effects: Assigns the the range [il.begin(), il.end()) to *this. More...
 
void assign (FwdIt first, FwdIt last BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c< !container_detail::is_convertible< FwdIt BOOST_CONTAINER_I size_type >::value &&(!container_detail::is_input_iterator< FwdIt >::value &&!container_detail::is_same< alloc_version BOOST_CONTAINER_I allocator_v0 >::value) >::type *=0))
 Effects: Assigns the the range [first, last) to *this. More...
 
void assign (size_type n, const value_type &val)
 Effects: Assigns the n copies of val to *this. More...
 
allocator_type get_allocator () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a copy of the internal allocator. More...
 
stored_allocator_typeget_stored_allocator () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a reference to the internal allocator. More...
 
const stored_allocator_typeget_stored_allocator () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a reference to the internal allocator. More...
 
iterator begin () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns an iterator to the first element contained in the vector. More...
 
const_iterator begin () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_iterator to the first element contained in the vector. More...
 
iterator end () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns an iterator to the end of the vector. More...
 
const_iterator end () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_iterator to the end of the vector. More...
 
reverse_iterator rbegin () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a reverse_iterator pointing to the beginning of the reversed vector. More...
 
const_reverse_iterator rbegin () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed vector. More...
 
reverse_iterator rend () BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a reverse_iterator pointing to the end of the reversed vector. More...
 
const_reverse_iterator rend () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_reverse_iterator pointing to the end of the reversed vector. More...
 
const_iterator cbegin () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_iterator to the first element contained in the vector. More...
 
const_iterator cend () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_iterator to the end of the vector. More...
 
const_reverse_iterator crbegin () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed vector. More...
 
const_reverse_iterator crend () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns a const_reverse_iterator pointing to the end of the reversed vector. More...
 
bool empty () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns true if the vector contains no elements. More...
 
size_type size () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns the number of the elements contained in the vector. More...
 
size_type max_size () const BOOST_CONTAINER_NOEXCEPT
 Effects: Returns the largest possible size of the vector. More...
 
void resize (size_type new_size)
 Effects: Inserts or erases elements at the end such that the size becomes n. More...
 
void resize (size_type new_size, default_init_t)
 Effects: Inserts or erases elements at the end such that the size becomes n. More...
 
void resize (size_type new_size, const Value &x)
 Effects: Inserts or erases elements at the end such that the size becomes n. More...
 
size_type capacity () const BOOST_CONTAINER_NOEXCEPT
 Effects: Number of elements for which memory has been allocated. More...
 
void reserve (size_type new_cap)
 Effects: If n is less than or equal to capacity(), this call has no effect. More...
 
void shrink_to_fit ()
 Effects: Tries to deallocate the excess of memory created with previous allocations. More...
 
reference front () BOOST_CONTAINER_NOEXCEPT
 Requires: !empty() More...
 
const_reference front () const BOOST_CONTAINER_NOEXCEPT
 Requires: !empty() More...
 
reference back () BOOST_CONTAINER_NOEXCEPT
 Requires: !empty() More...
 
const_reference back () const BOOST_CONTAINER_NOEXCEPT
 Requires: !empty() More...
 
reference operator[] (size_type n) BOOST_CONTAINER_NOEXCEPT
 Requires: size() > n. More...
 
const_reference operator[] (size_type n) const BOOST_CONTAINER_NOEXCEPT
 Requires: size() > n. More...
 
reference at (size_type n)
 Requires: size() > n. More...
 
const_reference at (size_type n) const
 Requires: size() > n. More...
 
Value * data () BOOST_CONTAINER_NOEXCEPT
 Returns: Allocator pointer such that [data(),data() + size()) is a valid range. More...
 
const Value * data () const BOOST_CONTAINER_NOEXCEPT
 Returns: Allocator pointer such that [data(),data() + size()) is a valid range. More...
 
iterator insert (const_iterator p, size_type n, const Value &x)
 Requires: p must be a valid iterator of *this. More...
 
iterator insert (const_iterator pos, InIt first, InIt last BOOST_CONTAINER_DOCIGN(BOOST_CONTAINER_I typename container_detail::enable_if_c< !container_detail::is_convertible< InIt BOOST_CONTAINER_I size_type >::value &&container_detail::is_input_iterator< InIt >::value >::type *=0))
 Requires: p must be a valid iterator of *this. More...
 
iterator insert (const_iterator pos, FwdIt first, FwdIt last, typename container_detail::enable_if_c< !container_detail::is_convertible< FwdIt, size_type >::value &&!container_detail::is_input_iterator< FwdIt >::value >::type *=0)
 
iterator insert (const_iterator pos, size_type num, InIt first, InIt last)
 Requires: p must be a valid iterator of *this. More...
 
iterator insert (const_iterator position, std::initializer_list< value_type > il)
 Requires: position must be a valid iterator of *this. More...
 
void pop_back () BOOST_CONTAINER_NOEXCEPT
 Effects: Removes the last element from the vector. More...
 
iterator erase (const_iterator position)
 Effects: Erases the element at position pos. More...
 
iterator erase (const_iterator first, const_iterator last)
 Effects: Erases the elements pointed by [first, last). More...
 
void swap (vector &x) BOOST_CONTAINER_NOEXCEPT_IF((!container_detail
 Effects: Swaps the contents of *this and x. More...
 
void swap (vector< Value, OtherAllocator > &x, typename container_detail::enable_if_c< container_detail::is_version< OtherAllocator, 0 >::value &&!container_detail::is_same< OtherAllocator, allocator_type >::value >::type *=0)
 Effects: Swaps the contents of *this and x. More...
 
void clear () BOOST_CONTAINER_NOEXCEPT
 Effects: Erases all the elements of the vector. More...
 
bool stable_reserve (size_type new_cap)
 Effects: If n is less than or equal to capacity(), this call has no effect. More...
 
void insert_ordered_at (const size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it)
 

Friends

template<class U , std::size_t OtherCapacity>
class static_vector
 
void swap (static_vector &x, static_vector &y)
 

Detailed Description

template<typename Value, std::size_t Capacity>
class boost::container::static_vector< Value, Capacity >

A variable-size array container with fixed capacity.

static_vector is a sequence container like boost::container::vector with contiguous storage that can change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.

A static_vector is a sequence that supports random access to elements, constant time insertion and removal of elements at the end, and linear time insertion and removal of elements at the beginning or in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity because elements are stored within the object itself similarly to an array. However, objects are initialized as they are inserted into static_vector unlike C arrays or std::array which must construct all elements on instantiation. The behavior of static_vector enables the use of statically allocated elements in cases with complex object lifetime requirements that would otherwise not be trivially possible.

Error Handling
Insertion beyond the capacity result in throwing std::bad_alloc() if exceptions are enabled or calling throw_bad_alloc() if not enabled.

std::out_of_range is thrown if out of bound access is performed in at() if exceptions are enabled, throw_out_of_range() if not enabled.

Template Parameters
ValueThe type of element that will be stored.
CapacityThe maximum number of elements static_vector can store, fixed at compile time.

Member Typedef Documentation

typedef Allocator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::allocator_type
inherited
template<typename Value , std::size_t Capacity>
typedef base_t::const_iterator boost::container::static_vector< Value, Capacity >::const_iterator

The const iterator type.

template<typename Value , std::size_t Capacity>
typedef base_t::const_pointer boost::container::static_vector< Value, Capacity >::const_pointer

The const pointer type.

template<typename Value , std::size_t Capacity>
typedef base_t::const_reference boost::container::static_vector< Value, Capacity >::const_reference

The value const reference type.

template<typename Value , std::size_t Capacity>
typedef base_t::const_reverse_iterator boost::container::static_vector< Value, Capacity >::const_reverse_iterator

The const reverse iterator.

template<typename Value , std::size_t Capacity>
typedef base_t::difference_type boost::container::static_vector< Value, Capacity >::difference_type

The pointers difference type.

template<typename Value , std::size_t Capacity>
typedef base_t::iterator boost::container::static_vector< Value, Capacity >::iterator

The iterator type.

template<typename Value , std::size_t Capacity>
typedef base_t::pointer boost::container::static_vector< Value, Capacity >::pointer

The pointer type.

template<typename Value , std::size_t Capacity>
typedef base_t::reference boost::container::static_vector< Value, Capacity >::reference

The value reference type.

template<typename Value , std::size_t Capacity>
typedef base_t::reverse_iterator boost::container::static_vector< Value, Capacity >::reverse_iterator

The reverse iterator type.

template<typename Value , std::size_t Capacity>
typedef base_t::size_type boost::container::static_vector< Value, Capacity >::size_type

The unsigned integral type used by the container.

typedef Allocator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::stored_allocator_type
inherited
template<typename Value , std::size_t Capacity>
typedef base_t::value_type boost::container::static_vector< Value, Capacity >::value_type

The type of elements stored in the container.

Constructor & Destructor Documentation

template<typename Value , std::size_t Capacity>
boost::container::static_vector< Value, Capacity >::static_vector ( )
inline

Constructs an empty static_vector.

Throws
Nothing.
Complexity
Constant O(1).
template<typename Value , std::size_t Capacity>
boost::container::static_vector< Value, Capacity >::static_vector ( size_type  count)
inlineexplicit

Constructs a static_vector containing count value initialized values.

Precondition
count <= capacity()
Parameters
countThe number of values which will be contained in the container.
Throws
If Value's value initialization throws.
Complexity
Linear O(N).
template<typename Value , std::size_t Capacity>
boost::container::static_vector< Value, Capacity >::static_vector ( size_type  count,
default_init_t   
)
inline

Constructs a static_vector containing count default initialized values.

Precondition
count <= capacity()
Parameters
countThe number of values which will be contained in the container.
Throws
If Value's default initialization throws.
Complexity
Linear O(N).
Note
Non-standard extension
template<typename Value , std::size_t Capacity>
boost::container::static_vector< Value, Capacity >::static_vector ( size_type  count,
value_type const &  value 
)
inline

Constructs a static_vector containing count copies of value.

Precondition
count <= capacity()
Parameters
countThe number of copies of a values that will be contained in the container.
valueThe value which will be used to copy construct values.
Throws
If Value's copy constructor throws.
Complexity
Linear O(N).
template<typename Value , std::size_t Capacity>
template<typename Iterator >
boost::container::static_vector< Value, Capacity >::static_vector ( Iterator  first,
Iterator  last 
)
inline

Constructs a static_vector containing copy of a range [first, last).

Precondition
  • distance(first, last) <= capacity()
  • Iterator must meet the ForwardTraversalIterator concept.
Parameters
firstThe iterator to the first element in range.
lastThe iterator to the one after the last element in range.
Throws
If Value's constructor taking a dereferenced Iterator throws.
Complexity
Linear O(N).
template<typename Value , std::size_t Capacity>
boost::container::static_vector< Value, Capacity >::static_vector ( std::initializer_list< value_type il)
inline

Constructs a static_vector containing copy of a range [il.begin(), il.end()).

Precondition
Parameters
ilstd::initializer_list with values to initialize vector.
Throws
If Value's constructor taking a dereferenced std::initializer_list throws.
Complexity
Linear O(N).
template<typename Value , std::size_t Capacity>
boost::container::static_vector< Value, Capacity >::static_vector ( static_vector< Value, Capacity > const &  other)
inline

Constructs a copy of other static_vector.

Parameters
otherThe static_vector which content will be copied to this one.
Throws
If Value's copy constructor throws.
Complexity
Linear O(N).
template<typename Value , std::size_t Capacity>
template<std::size_t C>
boost::container::static_vector< Value, Capacity >::static_vector ( static_vector< value_type, C > const &  other)
inline

Constructs a copy of other static_vector.

Precondition
other.size() <= capacity().
Parameters
otherThe static_vector which content will be copied to this one.
Throws
If Value's copy constructor throws.
Complexity
Linear O(N).
template<typename Value , std::size_t Capacity>
boost::container::static_vector< Value, Capacity >::static_vector ( BOOST_RV_REF(static_vector< Value, Capacity >)  other)
inline

Move constructor.

Moves Values stored in the other static_vector to this one.

Parameters
otherThe static_vector which content will be moved to this one.
Throws
Complexity
Linear O(N).
template<typename Value , std::size_t Capacity>
template<std::size_t C>
boost::container::static_vector< Value, Capacity >::static_vector ( BOOST_RV_REF_BEG static_vector< value_type, C > BOOST_RV_REF_END  other)
inline

Move constructor. Moves Values stored in the other static_vector to this one.

Precondition
other.size() <= capacity()
Parameters
otherThe static_vector which content will be moved to this one.
Throws
Complexity
Linear O(N).

Member Function Documentation

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::assign ( InIt  first,
InIt last  BOOST_CONTAINER_DOCIGNBOOST_CONTAINER_I typename container_detail::enable_if_c< !container_detail::is_convertible< InIt BOOST_CONTAINER_I size_type >::value &&(container_detail::is_input_iterator< InIt >::value||container_detail::is_same< alloc_version BOOST_CONTAINER_I allocator_v0 >::value) >::type *=0 
)
inlineinherited

Effects: Assigns the the range [first, last) to *this.

Throws: If memory allocation throws or T's copy/move constructor/assignment or T's constructor/assignment from dereferencing InpIt throws.

Complexity: Linear to n.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::begin(), boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::cend(), boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::end(), boost::xpressive::first, boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::insert(), boost::last, boost::n, and boost::interprocess::to_raw_pointer().

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::assign ( std::initializer_list< Value >  il)
inlineinherited

Effects: Assigns the the range [il.begin(), il.end()) to *this.

Throws: If memory allocation throws or T's constructor from dereferencing iniializer_list iterator throws.

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::assign ( FwdIt  first,
FwdIt last  BOOST_CONTAINER_DOCIGNBOOST_CONTAINER_I typename container_detail::enable_if_c< !container_detail::is_convertible< FwdIt BOOST_CONTAINER_I size_type >::value &&(!container_detail::is_input_iterator< FwdIt >::value &&!container_detail::is_same< alloc_version BOOST_CONTAINER_I allocator_v0 >::value) >::type *=0 
)
inlineinherited

Effects: Assigns the the range [first, last) to *this.

Throws: If memory allocation throws or T's copy/move constructor/assignment or T's constructor/assignment from dereferencing InpIt throws.

Complexity: Linear to n.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::begin(), boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::capacity(), boost::fusion::distance(), boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::end(), boost::xpressive::first, boost::last, and boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::size().

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::assign ( size_type  n,
const value_type val 
)
inlineinherited

Effects: Assigns the n copies of val to *this.

Throws: If memory allocation throws or T's copy/move constructor/assignment throws.

Complexity: Linear to n.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::assign().

reference boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::at ( size_type  n)
inlineinherited

Requires: size() > n.

Effects: Returns a reference to the nth element from the beginning of the container.

Throws: std::range_error if n >= size()

Complexity: Constant.

References boost::n.

const_reference boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::at ( size_type  n) const
inlineinherited

Requires: size() > n.

Effects: Returns a const reference to the nth element from the beginning of the container.

Throws: std::range_error if n >= size()

Complexity: Constant.

References boost::n.

reference boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::back ( )
inlineinherited

Requires: !empty()

Effects: Returns a reference to the last element of the container.

Throws: Nothing.

Complexity: Constant.

const_reference boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::back ( ) const
inlineinherited

Requires: !empty()

Effects: Returns a const reference to the last element of the container.

Throws: Nothing.

Complexity: Constant.

iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::begin ( void  )
inlineinherited

Effects: Returns an iterator to the first element contained in the vector.

Throws: Nothing.

Complexity: Constant.

const_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::begin ( void  ) const
inlineinherited

Effects: Returns a const_iterator to the first element contained in the vector.

Throws: Nothing.

Complexity: Constant.

typedef boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::BOOST_CONTAINER_IMPDEF ( iterator_impl  )
inherited
typedef boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::BOOST_CONTAINER_IMPDEF ( const_iterator_impl  ) const
inherited
typedef boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::BOOST_CONTAINER_IMPDEF ( container_detail::reverse_iterator< iterator >  )
inherited
typedef boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::BOOST_CONTAINER_IMPDEF ( container_detail::reverse_iterator< const_iterator >  ) const
inherited
size_type boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::capacity ( ) const
inlineinherited

Effects: Number of elements for which memory has been allocated.

capacity() is always greater than or equal to size().

Throws: Nothing.

Complexity: Constant.

const_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::cbegin ( ) const
inlineinherited

Effects: Returns a const_iterator to the first element contained in the vector.

Throws: Nothing.

Complexity: Constant.

const_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::cend ( ) const
inlineinherited

Effects: Returns a const_iterator to the end of the vector.

Throws: Nothing.

Complexity: Constant.

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::clear ( void  )
inlineinherited

Effects: Erases all the elements of the vector.

Throws: Nothing.

Complexity: Linear to the number of elements in the container.

const_reverse_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::crbegin ( ) const
inlineinherited

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed vector.

Throws: Nothing.

Complexity: Constant.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::end().

const_reverse_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::crend ( ) const
inlineinherited

Effects: Returns a const_reverse_iterator pointing to the end of the reversed vector.

Throws: Nothing.

Complexity: Constant.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::begin().

Value * boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::data ( )
inlineinherited

Returns: Allocator pointer such that [data(),data() + size()) is a valid range.

For a non-empty vector, data() == &front().

Throws: Nothing.

Complexity: Constant.

References boost::interprocess::to_raw_pointer().

const Value * boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::data ( ) const
inlineinherited

Returns: Allocator pointer such that [data(),data() + size()) is a valid range.

For a non-empty vector, data() == &front().

Throws: Nothing.

Complexity: Constant.

References boost::interprocess::to_raw_pointer().

bool boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::empty ( void  ) const
inlineinherited

Effects: Returns true if the vector contains no elements.

Throws: Nothing.

Complexity: Constant.

iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::end ( void  )
inlineinherited

Effects: Returns an iterator to the end of the vector.

Throws: Nothing.

Complexity: Constant.

const_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::end ( void  ) const
inlineinherited

Effects: Returns a const_iterator to the end of the vector.

Throws: Nothing.

Complexity: Constant.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::cend().

iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::erase ( const_iterator  position)
inlineinherited

Effects: Erases the element at position pos.

Throws: Nothing.

Complexity: Linear to the elements between pos and the last element. Constant if pos is the last element.

References boost::fusion::move(), boost::multiprecision::backends::p, boost::interprocess::to_raw_pointer(), and boost::container::vector_iterator_get_ptr().

iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::erase ( const_iterator  first,
const_iterator  last 
)
inlineinherited

Effects: Erases the elements pointed by [first, last).

Throws: Nothing.

Complexity: Linear to the distance between first and last plus linear to the elements between pos and the last element.

References boost::move(), boost::python::ptr(), boost::interprocess::to_raw_pointer(), and boost::container::vector_iterator_get_ptr().

reference boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::front ( void  )
inlineinherited

Requires: !empty()

Effects: Returns a reference to the first element of the container.

Throws: Nothing.

Complexity: Constant.

const_reference boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::front ( void  ) const
inlineinherited

Requires: !empty()

Effects: Returns a const reference to the first element of the container.

Throws: Nothing.

Complexity: Constant.

allocator_type boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::get_allocator ( void  ) const
inlineinherited

Effects: Returns a copy of the internal allocator.

Throws: If allocator's copy constructor throws.

Complexity: Constant.

stored_allocator_type& boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::get_stored_allocator ( )
inlineinherited

Effects: Returns a reference to the internal allocator.

Throws: Nothing

Complexity: Constant.

Note: Non-standard extension.

const stored_allocator_type& boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::get_stored_allocator ( ) const
inlineinherited

Effects: Returns a reference to the internal allocator.

Throws: Nothing

Complexity: Constant.

Note: Non-standard extension.

iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::insert ( const_iterator  p,
size_type  n,
const Value &  x 
)
inlineinherited

Requires: p must be a valid iterator of *this.

Effects: Insert n copies of x before pos.

Returns: an iterator to the first inserted element or p if n is 0.

Throws: If memory allocation throws or T's copy/move constructor throws.

Complexity: Linear to n.

References boost::container::vector_iterator_get_ptr().

iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::insert ( const_iterator  pos,
InIt  first,
InIt last  BOOST_CONTAINER_DOCIGNBOOST_CONTAINER_I typename container_detail::enable_if_c< !container_detail::is_convertible< InIt BOOST_CONTAINER_I size_type >::value &&container_detail::is_input_iterator< InIt >::value >::type *=0 
)
inlineinherited

Requires: p must be a valid iterator of *this.

Effects: Insert a copy of the [first, last) range before pos.

Returns: an iterator to the first inserted element or pos if first == last.

Throws: If memory allocation throws, T's constructor from a dereferenced InpIt throws or T's copy/move constructor/assignment throws.

Complexity: Linear to std::distance [first, last).

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::cbegin(), boost::xpressive::first, boost::it, boost::last, and boost::container::vector_iterator_get_ptr().

iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::insert ( const_iterator  pos,
FwdIt  first,
FwdIt  last,
typename container_detail::enable_if_c< !container_detail::is_convertible< FwdIt, size_type >::value &&!container_detail::is_input_iterator< FwdIt >::value >::type = 0 
)
inlineinherited
iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::insert ( const_iterator  pos,
size_type  num,
InIt  first,
InIt  last 
)
inlineinherited

Requires: p must be a valid iterator of *this.

num, must be equal to std::distance(first, last)

Effects: Insert a copy of the [first, last) range before pos.

Returns: an iterator to the first inserted element or pos if first == last.

Throws: If memory allocation throws, T's constructor from a dereferenced InpIt throws or T's copy/move constructor/assignment throws.

Complexity: Linear to std::distance [first, last).

Note: This function avoids a linear operation to calculate std::distance[first, last) for forward and bidirectional iterators, and a one by one insertion for input iterators. This is a a non-standard extension.

References BOOST_ASSERT, boost::fusion::distance(), boost::program_options::value(), boost::container::vector_iterator_get_ptr(), and boost::detail::void.

iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::insert ( const_iterator  position,
std::initializer_list< value_type il 
)
inlineinherited

Requires: position must be a valid iterator of *this.

Effects: Insert a copy of the [il.begin(), il.end()) range before position.

Returns: an iterator to the first inserted element or position if first == last.

Complexity: Linear to the range [il.begin(), il.end()).

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::insert_ordered_at ( const size_type  element_count,
BiDirPosConstIt  last_position_it,
BiDirValueIt  last_value_it 
)
inlineinherited
size_type boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::max_size ( void  ) const
inlineinherited

Effects: Returns the largest possible size of the vector.

Throws: Nothing.

Complexity: Constant.

References boost::container::allocator_traits< Allocator >::max_size().

template<typename Value , std::size_t Capacity>
static_vector& boost::container::static_vector< Value, Capacity >::operator= ( BOOST_COPY_ASSIGN_REF(static_vector< Value, Capacity >)  other)
inline

Copy assigns Values stored in the other static_vector to this one.

Parameters
otherThe static_vector which content will be copied to this one.
Throws
If Value's copy constructor or copy assignment throws.
Complexity
Linear O(N).

References boost::container::vector< Value, container_detail::static_storage_allocator< Value, Capacity > >::operator=().

template<typename Value , std::size_t Capacity>
static_vector& boost::container::static_vector< Value, Capacity >::operator= ( std::initializer_list< value_type il)
inline

Copy assigns Values stored in std::initializer_list to *this.

Parameters
ilThe std::initializer_list which content will be copied to this one.
Throws
If Value's copy constructor or copy assignment throws.
Complexity
Linear O(N).
template<typename Value , std::size_t Capacity>
template<std::size_t C>
static_vector& boost::container::static_vector< Value, Capacity >::operator= ( static_vector< value_type, C > const &  other)
inline

Copy assigns Values stored in the other static_vector to this one.

Precondition
other.size() <= capacity()
Parameters
otherThe static_vector which content will be copied to this one.
Throws
If Value's copy constructor or copy assignment throws.
Complexity
Linear O(N).

References boost::detail::const, and boost::spirit::x3::unicode::other.

template<typename Value , std::size_t Capacity>
static_vector& boost::container::static_vector< Value, Capacity >::operator= ( BOOST_RV_REF(static_vector< Value, Capacity >)  other)
inline

Move assignment.

Moves Values stored in the other static_vector to this one.

Parameters
otherThe static_vector which content will be moved to this one.
Throws
Complexity
Linear O(N).

References boost::move(), and boost::container::vector< Value, container_detail::static_storage_allocator< Value, Capacity > >::operator=().

template<typename Value , std::size_t Capacity>
template<std::size_t C>
static_vector& boost::container::static_vector< Value, Capacity >::operator= ( BOOST_RV_REF_BEG static_vector< value_type, C > BOOST_RV_REF_END  other)
inline

Move assignment. Moves Values stored in the other static_vector to this one.

Precondition
other.size() <= capacity()
Parameters
otherThe static_vector which content will be moved to this one.
Throws
Complexity
Linear O(N).

References boost::move().

reference boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::operator[] ( size_type  n)
inlineinherited

Requires: size() > n.

Effects: Returns a reference to the nth element from the beginning of the container.

Throws: Nothing.

Complexity: Constant.

References boost::n.

const_reference boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::operator[] ( size_type  n) const
inlineinherited

Requires: size() > n.

Effects: Returns a const reference to the nth element from the beginning of the container.

Throws: Nothing.

Complexity: Constant.

References boost::n.

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::pop_back ( )
inlineinherited

Effects: Removes the last element from the vector.

Throws: Nothing.

Complexity: Constant time.

reverse_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::rbegin ( )
inlineinherited

Effects: Returns a reverse_iterator pointing to the beginning of the reversed vector.

Throws: Nothing.

Complexity: Constant.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::end().

const_reverse_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::rbegin ( ) const
inlineinherited

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed vector.

Throws: Nothing.

Complexity: Constant.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::crbegin().

reverse_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::rend ( )
inlineinherited

Effects: Returns a reverse_iterator pointing to the end of the reversed vector.

Throws: Nothing.

Complexity: Constant.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::begin().

const_reverse_iterator boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::rend ( ) const
inlineinherited

Effects: Returns a const_reverse_iterator pointing to the end of the reversed vector.

Throws: Nothing.

Complexity: Constant.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::crend().

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::reserve ( size_type  new_cap)
inlineinherited

Effects: If n is less than or equal to capacity(), this call has no effect.

Otherwise, it is a request for allocation of additional memory. If the request is successful, then capacity() is greater than or equal to n; otherwise, capacity() is unchanged. In either case, size() is unchanged.

Throws: If memory allocation allocation throws or T's copy/move constructor throws.

References boost::container::vector< T, BOOST_CONTAINER_DOCONLY >::capacity().

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::resize ( size_type  new_size)
inlineinherited

Effects: Inserts or erases elements at the end such that the size becomes n.

New elements are value initialized.

Throws: If memory allocation throws, or T's copy/move or value initialization throws.

Complexity: Linear to the difference between size() and new_size.

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::resize ( size_type  new_size,
default_init_t   
)
inlineinherited

Effects: Inserts or erases elements at the end such that the size becomes n.

New elements are default initialized.

Throws: If memory allocation throws, or T's copy/move or default initialization throws.

Complexity: Linear to the difference between size() and new_size.

Note: Non-standard extension

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::resize ( size_type  new_size,
const Value &  x 
)
inlineinherited

Effects: Inserts or erases elements at the end such that the size becomes n.

New elements are copy constructed from x.

Throws: If memory allocation throws, or T's copy/move constructor throws.

Complexity: Linear to the difference between size() and new_size.

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::shrink_to_fit ( )
inlineinherited

Effects: Tries to deallocate the excess of memory created with previous allocations.

The size of the vector is unchanged

Throws: If memory allocation throws, or T's copy/move constructor throws.

Complexity: Linear to size().

size_type boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::size ( void  ) const
inlineinherited

Effects: Returns the number of the elements contained in the vector.

Throws: Nothing.

Complexity: Constant.

bool boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::stable_reserve ( size_type  new_cap)
inlineinherited

Effects: If n is less than or equal to capacity(), this call has no effect.

Otherwise, it is a request for allocation of additional memory (memory expansion) that will not invalidate iterators. If the request is successful, then capacity() is greater than or equal to n; otherwise, capacity() is unchanged. In either case, size() is unchanged.

Throws: If memory allocation allocation throws or T's copy/move constructor throws.

Note: Non-standard extension.

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::swap ( vector< Value, container_detail::static_storage_allocator< Value, Capacity > > &  x)
inlineinherited

Effects: Swaps the contents of *this and x.

Throws: Nothing.

Complexity: Constant.

void boost::container::vector< Value , BOOST_CONTAINER_DOCONLY >::swap ( vector< Value , OtherAllocator > &  x,
typename container_detail::enable_if_c< container_detail::is_version< OtherAllocator, 0 >::value &&!container_detail::is_same< OtherAllocator, allocator_type >::value >::type = 0 
)
inlineinherited

Effects: Swaps the contents of *this and x.

Throws: Nothing.

Complexity: Linear

Note: Non-standard extension to support static_vector

Friends And Related Function Documentation

template<typename Value , std::size_t Capacity>
template<class U , std::size_t OtherCapacity>
friend class static_vector
friend
template<typename Value , std::size_t Capacity>
void swap ( static_vector< Value, Capacity > &  x,
static_vector< Value, Capacity > &  y 
)
friend

The documentation for this class was generated from the following files: