On 7 October 2013 18:12, Tim Shen <timshe...@gmail.com> wrote: > On Mon, Oct 7, 2013 at 12:22 PM, Jonathan Wakely <jwakely....@gmail.com> > wrote: >> because that turns into the equivalent of a std::memset() on integers. > > Here I catch your idea. But think about the following example: > _M_exists.size() == 1000, but only 3 of the elements are true. Now > what I intend to do is assigning these 3 elements to false, rather > than reseting the whole vector. Is this called "pay for what you get"?
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.