#include <iostream>
#include <vector>
using namespace std;
template<
typename SV>
void PrintSV(
const SV& sv)
{
auto sz = sv.size();
cout << "size() = " << sz << " : ";
for (typename SV::size_type i = 0; i < sz; ++i)
{
if (sv.is_null(i))
cout << "NULL";
else
cout << sv.get(i);
cout << ", ";
}
cout << endl;
}
{
try
{
{
bit = 10;
bit = 11;
bit.add_null();
bit = 13;
bit = 14;
bit.add_null(2);
bit = 256;
bit.flush();
}
{
}
const unsigned char* buf = sv_lay.
buf();
{
bv_mask.set(0);
bv_mask.set(1);
}
{
}
}
catch(std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
#define BM_DECLARE_TEMP_BLOCK(x)
Sparse constainer sparse_vector<> for integer types using bit-transposition transform.
Compressed sparse container rsc_sparse_vector<> for integer types.
Serialization for sparse_vector<>
pre-processor un-defines to avoid global space pollution (internal)
back_insert_iterator get_back_inserter()
void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, statistics *stat=0)
run memory optimization for all vector slices
void sync(bool force)
Re-calculate rank-select index for faster access to vector.
SV::bvector_type bvector_type
sparse vector de-serializer
void deserialize(SV &sv, const unsigned char *buf, bool clear_sv=true)
void deserialize_range(SV &sv, const unsigned char *buf, size_type from, size_type to, bool clear_sv=true)
void set_bookmarks(bool enable, unsigned bm_interval=256) BMNOEXCEPT
Add skip-markers for faster range deserialization.
void serialize(const SV &sv, sparse_vector_serial_layout< SV > &sv_layout)
Serialize sparse vector into a memory buffer(s) structure.
succinct sparse vector with runtime compression using bit-slicing / 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 content.
layout class for serialization buffer structure
const unsigned char * buf() const BMNOEXCEPT
Return serialization buffer pointer.