Bounded Array Storage
Bounded Array
Description
The templated class bounded_array<T, N, ALLOC>
implements a bounded
storage array. The bounded array is similar to a C++ array type in that
its maximum size is bounded by N and is allocated on the stack instead
of the heap. Similarly a bounded_array
requires no secondary storage
and ALLOC is only used to specify size_type
and difference_type
.
When resized bounded_array
never reallocated the storage. It is
therefore always efficient to resize a bounded_array
but the size
bound N must not be exceeded.
Example
#include <boost/numeric/ublas/storage.hpp>
int main () {
using namespace boost::numeric::ublas;
bounded_array<double, 3> 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
Parameter |
Description |
Default |
|
The type of object stored in the array. |
|
|
The allocation size of the array. |
|
|
An STL Allocator |
std::allocator |
Model of
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.
-
Member | Where defined | Description |
---|---|---|
|
||
|
Defined as |
|
|
Defined as |
|
|
Defined as |
|
|
Defined as |
|
|
Defined as |
|
|
Defined as |
|
|
Defined as |
|
|
Defined as |
|
|
Defined as |
|
|
Defined as |
|
|
Creates an |
|
|
Creates a uninitialized |
|
|
Creates an initialized |
|
|
The copy constructor. |
|
|
Deallocates the |
|
|
Reallocates a |
|
|
Reallocates a |
|
|
Returns the size of the |
|
|
Returns a |
|
|
Returns a reference of the |
|
|
The assignment operator. |
|
|
Assigns a temporary. May change the array |
|
|
Swaps the contents of the arrays. |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, Joerg Walter,
Gunter Winkler
Copyright (©) 2021 Shikhar Vashistha
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 ).