May 2017
Intermediate to advanced
590 pages
17h 18m
English
std::vector<bool> is not a standard vector because it is designed to provide space optimization by storing a single bit for each element instead of a Boolean value. Therefore, its elements are not stored in a contiguous sequence and cannot be substituted for an array of Booleans. Due to this:
std::vector<bool> bv; bv.resize(10); auto& bit = bv[0]; // error
auto& bit = *bv.begin(); // error
Read now
Unlock full access