I want to pass bitsets to a function. What size should I assign to the bitset parameter bits in the function prototype if the bitsets have different sizes?
For example:
bitset<3> a;
bitset<4> b;
void ABC(bitset<size> bits){
...
}
ABC(a);
ABC(b);
This is not possible with STL
bitset.std::bitset<N>template requires a fixed size in advance (at compile-time)However, one way you can do this by using
boost::dynamic_bitsetSomething like following:
See here