Example how to use logical operations between arrays and bit-vectors.
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
using std::vector;
using std::list;
#ifdef BM_NO_STL
# undef BM_NO_STL
#endif
using namespace std;
inline
{
cout << n << endl;;
}
{
if (first == last)
cout << "<EMPTY SET>";
else
for(;first != last; ++first)
cout << *first << ";";
cout << endl;
}
{
try
{
bv[10] = true;
bv[100] = true;
bv[10000] = true;
cout << "Source set 1:";
cout << "Source set 2:";
cout << "Result 1(AND): ";
bv[10] = true;
bv[100] = true;
bv[10000] = true;
cout << "Result 2(OR): ";
std::sort(&arr[0], &arr[0] + (sizeof(arr)/sizeof(arr[0])));
cout << "Result 3(AND): ";
cout << "Result 4(MINUS): ";
}
catch(std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}
Compressed bit-vector bvector<> container, set algebraic methods, traversal iterators.
Algorithms for bvector<> (main include)
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
enumerator end() const
Returns enumerator pointing on the next bit after the last.
void combine_and_sorted(BV &bv, It first, It last)
AND Combine bitvector and the iterable sequence.
void combine_and(BV &bv, It first, It last)
AND Combine bitvector and the iterable sequence.
void combine_sub(BV &bv, It first, It last)
SUB Combine bitvector and the iterable sequence.
void combine_or(BV &bv, It first, It last)
OR Combine bitvector and the iterable sequence.
void Print(bm::bvector<>::size_type n)
void PrintContainer(T first, T last)