BitVec or counters

When should one use a BitVec vs using a counter struct like:

struct Counter {
    ones: u32,
    zeroes: u32,
}

When is one better suited to the situation than the other ? I have a failure of imagination I think.

BitVec tracks the position every 1 and 0. If you don't care about that, then your Counter is probably going to be a lot easier and faster.

3 Likes