L
Lionel B
On my platform I find that the std::vector<bool> specialisation incurs a
significant performance hit in some circumstances (when compared, say, to
std::vector<int> programmed analagously). Is it possible to "spoof"
std::vector into implementing a "true" vector of bool rather than the
specialisation?
Say I do:
typedef bool boolreally;
std::vector<booleally> bvec;
do I still get the std::vector<bool> specialisation? (I suspect the answer
is "yes", but I'm not sure how typedef-ed types are interpreted as
template parameters).
I can (and currently do) use std::vector<int> at times, but I'd rather
not, when what I want really is "bool" rather than "int" (or anything else).
As I understand it, the justification for the std::vector<bool>
specialisation is to reduce the space overhead (possibly at the cost of
a time overhead). Personally I can't envisage many circumstances where one
mightn't use std::bitset rather than std::vector<bool> if space were
an issue... I thus find the specialisation somewhat vexing. Am I
misunderstanding something here?
significant performance hit in some circumstances (when compared, say, to
std::vector<int> programmed analagously). Is it possible to "spoof"
std::vector into implementing a "true" vector of bool rather than the
specialisation?
Say I do:
typedef bool boolreally;
std::vector<booleally> bvec;
do I still get the std::vector<bool> specialisation? (I suspect the answer
is "yes", but I'm not sure how typedef-ed types are interpreted as
template parameters).
I can (and currently do) use std::vector<int> at times, but I'd rather
not, when what I want really is "bool" rather than "int" (or anything else).
As I understand it, the justification for the std::vector<bool>
specialisation is to reduce the space overhead (possibly at the cost of
a time overhead). Personally I can't envisage many circumstances where one
mightn't use std::bitset rather than std::vector<bool> if space were
an issue... I thus find the specialisation somewhat vexing. Am I
misunderstanding something here?