Sparse Storage
Default Standard Map
Description
The templated class map_std<I, T, ALLOC>
provides a wrapper for the
standard library associative container std::map
. The wrapper has one
simple purpose. It allows the definition of a default template parameter
(for the adapted array) when declaring the sparse container types.
Example
#include <boost/numeric/ublas/storage_sparse.hpp>
int main () {
using namespace boost::numeric::ublas;
map_std<int, 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_sparse.hpp.
Template parameters
Parameter |
Description |
Default |
|
The type of index stored in the array. |
|
|
The type of object stored in the array. |
|
|
An STL Allocator |
std::allocator |
Model of
Reversible Container.
Type requirements
None, except for those imposed by the requirements of Reversible Container.
Public base classes
std::map
Map Array
Description
The templated class map_array<I, T, ALLOC>
implements a std::map
like associative container as a sorted array. It therefore some of the
Associative Container interface without having the same semantics as an
std::map.
At any time the map_array
has a capacity up to which new element can
be inserted. If insert
would cause the size of the map_array
to
exceeds its capactity then it is reallocated. Iterators and reference
are invalidated. The capacity can be directly control using the
reserve
member function.
Example
#include <boost/numeric/ublas/storage_sparse.hpp>
int main () {
using namespace boost::numeric::ublas;
map_array<int, 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_sparse.hpp.
Template parameters
Parameter |
Description |
Default |
|
The type of index stored in the array. |
|
|
The type of object stored in the array. |
|
|
An STL Allocator |
std::allocator |
Model of
Reversible Container.
Type requirements
None, except for those imposed by the requirements of Reversible Container.
Public base classes
None.
Members
Member | Description |
---|---|
|
Allocates a |
|
The copy constructor. |
|
Deallocates the |
|
Changes the`map_array` capacity.
It can hold at most`capacity` elements without reallocation. The
capacity can be reduced such that |
|
Returns the size of the |
|
Returns the capacity of the |
|
Returns a reference of the
element that is associated with a particular index. If the |
|
The assignment operator. |
|
Assigns a temporary. May
change the array |
|
Swaps the contents of the arrays. |
|
Inserts |
|
Inserts |
|
Erases the value at |
|
Clears the array. |
|
Finds an element whose
index is |
|
Finds an element whose index is |
|
Finds the first
element whose index is not less than |
|
Finds the first element whose
index is not less than |
|
Finds the first
element whose index is greater than |
|
Finds the first element whose
index is greater than |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
|
Returns a |
|
Returns a |
Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
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 ).