58 unsigned arr[3] = {1,2,3};
67 cout <<
"sv1.size() = " << sv1.
size() << endl;
71 for (
unsigned i = 0; i < sv1.
size(); ++i)
73 cout << sv1.
at(i) <<
",";
78 unsigned arr2[5] = {10, 20, 30, 40, 50};
81 cout <<
"sv1.size() = " << sv1.
size() << endl;
85 std::for_each(sv1.
begin(), sv1.
end(),
86 [](value_type n) { cout << n <<
", "; });
100 int arr[3] = {1,-2,3};
104 int arr2[5] = {-10, 20, 30, 40, -50};
111 cout <<
"sv1.size() = " << sv1.
size() << endl;
115 std::for_each(sv1.
begin(), sv1.
end(), [] (
auto n) { cout << n <<
", "; }
128 cout << endl << endl;
133 catch(std::exception& ex)
135 std::cerr << ex.what() << std::endl;
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.
pre-processor un-defines to avoid global space pollution (internal)
succinct sparse vector with runtime compression using bit-slicing / transposition method
value_type at(size_type idx) const
access specified element with bounds checking
size_type size() const BMNOEXCEPT
return size of the vector
const_iterator end() const BMNOEXCEPT
Provide const iterator access to the end
const_iterator begin() const BMNOEXCEPT
Provide const iterator access to container content
void import(const value_type *arr, size_type arr_size, size_type offset=0, bool set_not_null=true)
Import list of elements from a C-style array.
void optimize(bm::word_t *temp_block=0, typename bvector_type::optmode opt_mode=bvector_type::opt_compress, typename sparse_vector< Val, BV >::statistics *stat=0)
run memory optimization for all vector planes
static void Demo1()
bm::sparse_vector for unsigned int data
bm::sparse_vector< unsigned, bm::bvector<> > sparse_vector_u32
bm::sparse_vector< int, bm::bvector<> > sparse_vector_i32
static void Demo2()
bm::sparse_vector can also support signed ints.