Back to Arangodb

Unbounded Array Storage

3rdParty/boost/1.78.0/libs/numeric/ublas/doc/unbounded_array.html

3.12.9.16.6 KB
Original Source

Unbounded Array Storage

Unbounded Array

Description

The templated class unbounded_array<T, ALLOC> implements a unbounded storage array using an allocator. The unbounded array is similar to a std::vector in that in can grow in size beyond any fixed bound. However unbounded_array is aimed at optimal performance. Therefore unbounded_array does not model a Sequence like std::vector does.

When resized unbounded_array will reallocate it's storage even if the new size requirement is smaller. It is therefore inefficient to resize a unbounded_array

Example

#include <boost/numeric/ublas/storage.hpp>

int main () {
    using namespace boost::numeric::ublas;
    unbounded_array<double> a (3);
    for (unsigned i = 0; i < a.size (); ++ i) {
        a [i] = i;
        std::cout << a [i] << std::endl;
    }
}

Definition

Defined in the header storage.hpp.

Template parameters

ParameterDescriptionDefault
TThe type of object stored in the array.
ALLOCAn STL Allocatorstd::allocator

Model of

Storage

Type requirements

None, except for those imposed by the requirements of Storage.

Public base classes

None.

Members

  • The description does not describe what the member actually does, this can be looked up in the corresponding concept documentation, but instead contains a remark on the implementation of the member inside this model of the concept.
  • Typography:
    • Members that are not part of the implemented concepts are in blue.
MemberWhere definedDescription
value_typeContainer
pointerContainerDefined as value_type*
const_pointerContainerDefined as const value_type*
referenceContainerDefined as value_type&
const_referenceContainerDefined as const value_type&
size_typeContainerDefined as Alloc::size_type
difference_typeContainerDefined as Alloc::difference_type
iteratorContainerDefined as pointer
const_iteratorContainerDefined as const_pointer
revere_iteratorContainerDefined as std::reverse_iterator<iterator>
const_revere_iteratorContainerDefined as std::reverse_iterator<const_iterator>
allocator_typeDefined as ALLOC
explicit unbounded_array (ALLOC &a = ALLOC())StorageCreates an unbounded_array that holds zero elements, using a specified allocator.
explicit unbounded_array (size_type size, ALLOC &a = ALLOC())StorageCreates a uninitialized unbounded_array that holds size elements, using a specified allocator. All the elements are default constructed.
unbounded_array (size_type size, const T& init, ALLOC& a = ALLOC())StorageCreates an initialized unbounded_array that holds size elements, using a specified allocator. All the elements are constructed from the init value.
unbounded_array (const unbounded_array &a)ContainerThe copy constructor.
~unbounded_array ()ContainerDeallocates the unbounded_array itself.
void resize (size_type n)StorageReallocates an unbounded_array to hold n elements. Values are uninitialised.
void resize(size_type n, const T& t)StorageReallocates an unbounded_array to hold n elements. Values are copies of t
size_type size () constContainerReturns the size of the unbounded_array.
const_reference operator [] (size_type i) constContainerReturns a const reference of the i -th element.
reference operator [] (size_type i)ContainerReturns a reference of the i-th element.
unbounded_array &operator = (const unbounded_array &a)ContainerThe assignment operator.
unbounded_array &assign_temporary (unbounded_array &a)Assigns a temporary. May change the array a.
void swap (unbounded_array &a)ContainerSwaps the contents of the arrays.
const_iterator begin () constContainerReturns a const_iterator pointing to the beginning of the unbounded_array.
const_iterator end () constContainerReturns a const_iterator pointing to the end of the unbounded_array.
iterator begin ()ContainerReturns a iterator pointing to the beginning of the unbounded_array.
iterator end ()ContainerReturns a iterator pointing to the end of the unbounded_array.
const_reverse_iterator rbegin () constReversible ContainerReturns a const_reverse_iterator pointing to the beginning of the reversed unbounded_array.
const_reverse_iterator rend () constReversible ContainerReturns a const_reverse_iterator pointing to the end of the reversed unbounded_array.
reverse_iterator rbegin ()Reversible ContainerReturns a reverse_iterator pointing to the beginning of the reversed unbounded_array.
reverse_iterator rend ()Reversible ContainerReturns a reverse_iterator pointing to the end of the reversed unbounded_array.

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).