J
Joseph Turian
Okay.
I have a vector<bool> of fixed size N. Let's call it bob.
I'm zero'ing bob quite a bit, i.e.:
bob = vector<bool>(N, false);
Naturally, this is quite slow, because of all the object creation.
Can I do any better than the following:
bob.clear(); bob.resize(N, false);
?
I don't mind changing the container type or the entry type (e.g.
bool->char), so if you have any suggestions in that vein then fire
away.
I'm trying to get this to be really fast, so I'll entertain any
so-called "extreme solution".
Joseph
I have a vector<bool> of fixed size N. Let's call it bob.
I'm zero'ing bob quite a bit, i.e.:
bob = vector<bool>(N, false);
Naturally, this is quite slow, because of all the object creation.
Can I do any better than the following:
bob.clear(); bob.resize(N, false);
?
I don't mind changing the container type or the entry type (e.g.
bool->char), so if you have any suggestions in that vein then fire
away.
I'm trying to get this to be really fast, so I'll entertain any
so-called "extreme solution".
Joseph