42 cout << sv.size() <<
": [ EMPTY ]" << endl;
45 cout << sv.size() <<
": [ ";
46 for (
unsigned i = 0; i < sv.size(); ++i)
48 unsigned v = sv.at(i);
49 bool is_null = sv.is_null(i);
87 unsigned arr[3] = {1,2,3};
143 for (; en.
valid(); ++en)
146 unsigned v = sv1[idx];
147 std::cout <<
"[" << idx <<
"] = " << v <<
", ";
158 std::vector<unsigned> v1(sv1.
size());
162 for (
unsigned i = 0; i < v1.size(); ++i)
164 cout << v1[i] <<
",";
169 catch(std::exception& ex)
171 std::cerr << ex.what() << std::endl;
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
Sparse constainer sparse_vector<> for integer types using bit-transposition transform.
size_type decode(value_type *arr, size_type idx_from, size_type dec_size, bool zero_mem=true) const
Bulk export list of elements to a C-style array.
void set(size_type idx, value_type v)
set specified element with bounds checking and automatic resize
const bvector_type * get_null_bvector() const
Get bit-vector of assigned values or NULL (if not constructed that way)
sparse_vector< Val, BV > & join(const sparse_vector< Val, BV > &sv)
join all with another sparse vector using OR operation
void import(const value_type *arr, size_type arr_size, size_type offset=0)
Import list of elements from a C-style array.
sparse vector with runtime compression using bit transposition method
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
void push_back(value_type v)
push value back into vector
support "non-assigned" or "NULL" logic
void resize(size_type sz)
resize vector
bool valid() const
Checks if iterator is still valid.
void set_null(size_type idx)
set specified element to unassigned value (NULL)
size_type size() const
return size of the vector
Constant iterator designed to enumerate "ON" bits.
static void print_svector(const bm::sparse_vector< unsigned, bm::bvector<> > &sv)
void clear(size_type idx, bool set_null=false)
clear specified element with bounds checking and automatic resize