Array StorageThe templated class carray_adaptor<T> implements a storage array using a pointer to an existing memory buffer (a C array for example). The storage specified array size must never exceed the size of the memory buffer.
carray_adaptor defines size_type as size_t and difference_type as std::ptrdiff_t.
#include <boost/numeric/ublas/storage.hpp>
int main () {
using namespace boost::numeric::ublas;
double aarray[10];
carray_adaptor<double> a (aarray, 3);
for (unsigned i = 0; i < a.size (); ++ i) {
a [i] = i;
std::cout << a [i] << std::endl;
}
}
Defined in the header storage.hpp.
| Parameter | Description | Default |
|---|---|---|
T |
The type of object stored in the array. |
Storage but NOT Copy Constructable
None, except for those imposed by the requirements of Storage.
None.
| Member | Where defined | Description |
|---|---|---|
value_type | Container | |
pointer | Container | Defined as value_type* |
const_pointer | Container | Defined as const value_type* |
reference | Container | Defined as value_type& |
const_reference | Container | Defined as const value_type& |
size_type | Container | Defined as Alloc::size_type |
difference_type | Container | Defined as Alloc::difference_type |
iterator | Container | Defined as pointer |
const_iterator | Container | Defined as const_pointer |
revere_iterator | Container | Defined as std::reverse_iterator<iterator> |
const_revere_iterator | Container | Defined as std::reverse_iterator<const_iterator> |
carray_adaptor () |
Storage | Creates an carray_adaptor that holds zero elements. |
carray_adaptor (size_type size) |
Storage | The size-constructor is undefined. A carray_adaptor cannot be constructed like this as a memory buffer cannot
be specifed in this context. |
carray_adaptor (size_type size, const T& init) |
Storage | The fill-constructor is undefined. A carray_adaptor cannot be constructed like this as a memory buffer cannot
be specifed in this context. |
bounded_array (size_type size, pointer data) |
Storage | Creates a uninitialized bounded_array that holds size elements from the memory buffer data. All the elements are default constructed. |
bounded_array (size_type size, pointer data, const T& init) |
Storage | Creates an initialized bounded_array that holds size elements from the memory buffer data. All the elements are constructed from the init value. |
carray_adaptor (const carray_adaptor &c) |
Container | The copy constructor is private and undefined. A carray_adaptor cannot be constructed like this as a memory buffer cannot
be specifed in this context. |
~carray_adaptor () |
Container | Deallocates the carray_adaptor itself. |
void resize (size_type size) |
Storage | Reallocates a carray_adaptor to hold size elements. |
void resize (size_type size, const T& t) |
Storage | Reallocates a carray_adaptor to hold size elements. |
void resize (size_type size pointer data) |
Storage | Reallocates a carray_adaptor to hold size elements. |
void resize (size_type size pointer data, const T& t) |
Storage | Reallocates a carray_adaptor to hold size elements. |
size_type size () const |
Container | Returns the size of the carray_adaptor. |
const_reference operator [] (size_type i) const |
Container | Returns a const reference of the i -th element. |
reference operator [] (size_type i) |
Container | Returns a reference of the i-th element. |
carray_adaptor &operator = (const carray_adaptor &a) |
Container | The assignment operator. |
carray_adaptor &assign_temporary (carray_adaptor &a) |
Assigns a temporary. May change the array a. |
|
void swap (carray_adaptor &a) |
Container | Swaps the contents of the arrays. |
const_iterator begin () const |
Container | Returns a const_iterator pointing to the beginning of the carray_adaptor. |
const_iterator end () const |
Container | Returns a const_iterator pointing to the end of the carray_adaptor. |
iterator begin () |
Container | Returns a iterator pointing to the beginning of the carray_adaptor. |
iterator end () |
Container | Returns a iterator pointing to the end of the carray_adaptor. |
const_reverse_iterator rbegin () const |
Reversible Container | Returns a const_reverse_iterator pointing to the beginning of the reversed carray_adaptor. |
const_reverse_iterator rend () const |
Reversible Container | Returns a const_reverse_iterator pointing to the end of the reversed carray_adaptor. |
reverse_iterator rbegin () |
Reversible Container | Returns a reverse_iterator pointing to the beginning of the reversed carray_adaptor. |
reverse_iterator rend () |
Reversible Container | Returns a reverse_iterator pointing to the end of the reversed carray_adaptor. |