#include <iostream>
#include <vector>
using namespace std;
static
{
if (sv.size() == 0)
{
cout << sv.size() << ": [ EMPTY ]" << endl;
return;
}
cout << sv.size() << ": [ ";
for (unsigned i = 0; i < sv.size(); ++i)
{
unsigned v = sv.at(i);
bool is_null = sv.is_null(i);
if (is_null)
cout << "NULL";
else
cout << v << "";
if (i == sv.size()-1)
cout << " ]";
else
cout << ", ";
}
cout << endl;
}
{
try
{
sv1.resize(10);
sv1.set(2, 25);
sv1.set(3, 35);
sv1.set(7, 75);
sv1.set_null(7);
unsigned arr[3] = {1,2,3};
sv1.import(arr, 3, 9);
sv1.clear(2, true);
sv1.clear(2, false);
sv1.clear(3, false);
sv1.clear();
sv1.resize(3);
sv1.push_back(10);
sv1.push_back(20);
sv1.push_back(30);
{
}
sv1.set(1, 10);
sv1.set(2, 20);
sv1.push_back(40);
{
sv1.set_null(bv_set_null);
}
sv1.join(sv2);
sv3.resize(9);
sv3.push_back(300);
sv1.join(sv3);
{
if (bv_non_null)
{
{
unsigned idx = *en;
unsigned v = sv1[idx];
std::cout << "[" << idx << "] = " << v << ", ";
}
std::cout << endl;
}
}
{
std::vector<unsigned> v1(sv1.size());
sv1.decode(&v1[0], 0, sv1.size());
for (unsigned i = 0; i < v1.size(); ++i)
{
cout << v1[i] << ",";
}
cout << 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.
pre-processor un-defines to avoid global space pollution (internal)
Constant iterator designed to enumerate "ON" bits.
bool valid() const BMNOEXCEPT
Checks if iterator is still valid.
Bitvector Bit-vector container with runtime compression of bits.
enumerator first() const
Returns enumerator pointing on the first non-zero bit.
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset
succinct sparse vector with runtime compression using bit-slicing / transposition method
void push_back(value_type v)
push value back into vector
@ use_null
support "non-assigned" or "NULL" logic
void print_svector(const SV &sv, bool show_nulls=false)
Prints the vector using is_null() and get() Please note, that random access is not the fastest,...