If I have a bitset like:
std::bitset<8> bs = 00000101;
how can I only retrieve the bitset "101" from bs? To make things simpler, I already know I will need the first three bits.
With @Baum's help I have something like this so far:
std::bitset<8> bs = 00000101;
int off = 3; // the number of bits I would like
std::string offStr; // final substring of bitset I wanted
for (std::size_t i = 0; i < off; ++i)
{
offStr += bs[i];
}
return offStr; // resulting substring