Example for finding first and last bits in bit-vector (dynamic range).Ranges of bit-vectors can be used to find probability of intersection. For instance, in some corner cases AND product can be predicted empty if vectors belong to different ranges.
@sa bm::bvector<>::find()
@sa bm::bvector<>::find_reverse()
@sa bm::bvector<>::find_range()
#include <stdlib.h>
#include <iostream>
#include <vector>
static
{
{
if ((rand() % 10))
{
}
}
}
{
try
{
cout <<
"bv1 count = " << bv1.
count() << endl;
cout <<
"bv2 count = " << bv2.
count() << endl;
bool found;
unsigned first, last;
if (found)
cout << "bv1 first = " << first << endl;
if (found)
cout << "bv1 last = " << last << endl;
if (found)
cout << "bv2 first = " << first << endl;
if (found)
cout << "bv2 last = " << last << endl;
if (found)
cout << "bv1 range = [" << first << ", " << last << "]" << endl;
if (found)
cout << "bv2 range = [" << first << ", " << last << "]" << endl;
}
catch(std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}