If you know exactly how may bits you are going to iterate and that you access bit in sequence, iterator is faster than get(). However, be extremely careful since there is no check whatsoever. (Performance is the reason for the iterator to exist in the first place.)
| 62 | // However, be extremely careful since there is no check whatsoever. |
| 63 | // (Performance is the reason for the iterator to exist in the first place.) |
| 64 | Iterator iterAt(int i) const noexcept { return {_bits.cbegin() + i}; } |
| 65 | Iterator begin() const noexcept { return _bits.cbegin(); } |
| 66 | Iterator end() const noexcept { return _bits.cend(); } |
| 67 |