2 #ifndef vbl_sparse_array_2d_h_ 3 #define vbl_sparse_array_2d_h_ 25 # include <vcl_msvc_warnings.h> 38 bool put(
unsigned i,
unsigned j,
const T& t)
58 void erase(
unsigned i,
unsigned j) {
63 bool fullp(
unsigned i,
unsigned j)
const 75 std::ostream&
print(std::ostream& out)
const 78 out <<
'(' << (*p).first.first
79 <<
',' << (*p).first.second
80 <<
"): " << (*p).second << std::endl;
92 #ifndef VBL_SPARSE_ARRAY_BASE_INSTANTIATE 93 #define VBL_SPARSE_ARRAY_BASE_INSTANTIATE(T) \ 94 extern "please include vbl/vbl_sparse_array_base.hxx instead" 95 #endif // VBL_SPARSE_ARRAY_BASE_INSTANTIATE 96 #define VBL_SPARSE_ARRAY_2D_INSTANTIATE(T) \ 97 extern "please include vbl/vbl_sparse_array_2d.hxx instead" 99 #endif // vbl_sparse_array_2d_h_ Sparse 2D array allowing space efficient access of the form s(300,700) =2.
vbl_sparse_array_base< T, std::pair< unsigned, unsigned > >::const_iterator const_iterator
bool put(Index, const T &)
Put a value into location (i).
T & operator()(unsigned i, unsigned j)
Return contents of location (i,j).
void erase(Index)
Erase element at location (i). Assertion failure if not yet filled.
const_iterator end() const
A bidirectional iterator pointing just beyond last non-empty element.
void erase(unsigned i, unsigned j)
Erase element at location (i,j). Assertion failure if not yet filled.
T * get_addr(Index)
Return the address of location (i). 0 if not yet filled.
const_iterator begin() const
A bidirectional iterator pointing at the first non-empty element.
std::ostream & operator<<(std::ostream &s, const vbl_sparse_array_2d< T > &a)
Stream operator - print the Array to a stream in "(i,j): value" format.
base class for sparse arrays.
T * get_addr(unsigned i, unsigned j)
Return the address of location (i,j). 0 if not yet filled.
bool fullp(Index) const
Return true if location (i) has been filled.
A fully featured sparse array which devolves indexing to its templated type.
T & operator()(Index i)
Return contents at (i).
bool put(unsigned i, unsigned j, const T &t)
Put a value into location (i,j).
std::ostream & print(std::ostream &out) const
Print the Array to a stream in "(i,j): value" format.
bool fullp(unsigned i, unsigned j) const
Return true if location (i,j) has been filled.
vbl_sparse_array_base< T, std::pair< unsigned, unsigned > >::Index_type Index_type