Example how to use logical operations between arrays and bit-vectors
- See also
- bm::combine_and
-
bm::combine_and_sorted
-
bm::combine_sub
-
bm::combine_or
-
bm::combine_xor
-
bvsetalgebra.cpp
#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;
}
void clear(const size_type *ids, size_type ids_size, bm::sort_order so=bm::BM_UNKNOWN)
clear list of bits in this bitset