On Mon, Oct 7, 2013 at 1:28 PM, Jonathan Wakely <jwakely....@gmail.com> wrote: > std::memset() on about 125 bytes is not a big deal, I doubt it's > significantly more expensive than the calculations to find the right > bits and do the necessary masking for three elements. > std::vector<bool> is a strange beast, remember.
OK so I may change to use something else(bitset?) next time I encounter this. Is copying 125 bytes more expensive comparing to 3 assignment and substrction? Because it *is* cheap to find all elements that's true, they are just in _M_base(in the latest patch). So: while (!this->empty()) this->pop(); ...will be executed only 3 times. I think it's cheaper than copying a long-enough and sparse-enough byte chunk? Or at least we should theck the density(_M_base.size() / _M_exists.size()) of _M_exists ? -- Tim Shen