Measure the running time with `time ./test` on Linux
#include <iostream> | |
#include <boost/dynamic_bitset.hpp> | |
int maxn = 1e8; | |
int bits = 100; | |
void test1() { | |
boost::dynamic_bitset<> bs(bits, abs(rand())); | |
int a = 0; | |
for (int i = 0; i < maxn; i++) { | |
a += bs.count(); | |
} | |
std::cout << a << std::endl; | |
} | |
int main() { | |
std::cout << boost::dynamic_bitset<>::bits_per_block << std::endl; | |
srand(time(NULL)); | |
test1(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment