Example of how to use bm::rsc_sparse_vector<>::const_iterator.
#include <iostream>
#include <vector>
using namespace std;
template<
typename SV>
void PrintSV(
const SV& sv)
{
typename SV::const_iterator it = sv.begin();
typename SV::const_iterator it_end = sv.end();
for (; it != it_end; ++it)
{
if (it.is_null())
cout << "NULL";
else
cout << *it;
cout << ", ";
}
cout << endl;
}
{
try
{
{
bit = 10;
bit = 11;
bit = 13;
bit = 14;
bit.add_null(2);
bit = 256;
bit.flush();
}
{
{
do
{
cout << "NULL";
else
cout << v;
cout << ", ";
cout << endl;
cout << it.
value() << endl;
}
}
}
catch(std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
Sparse constainer sparse_vector<> for integer types using bit-transposition transform.
Compressed sparse container rsc_sparse_vector<> for integer types.
void add_null() BMNOEXCEPT
add NULL (no-value) to the container
Const iterator to traverse the rsc sparse vector.
bool advance() BMNOEXCEPT
advance iterator forward by one
void go_to(size_type pos) BMNOEXCEPT
re-position to a specified position
bool is_null() const BMNOEXCEPT
Get NULL status.
bool valid() const BMNOEXCEPT
Returns true if iterator is at a valid position.
value_type value() const
Get current position (value)
Rank-Select compressed sparse vector.
back_insert_iterator get_back_inserter()
void sync(bool force)
Re-calculate prefix sum table used for rank search.
const_iterator get_const_iterator(size_type idx) const BMNOEXCEPT
Get const_itertor re-positioned to specific element.
sparse vector with runtime compression using bit transposition method
bm::sparse_vector< unsigned, bm::bvector<> > sparse_vector_u32
bm::rsc_sparse_vector< unsigned, sparse_vector_u32 > rsc_sparse_vector_u32
void PrintSV(const SV &sv)
Print sparse vector.