Month: April 2016

Status
Blaok

According to cplusplus.com, std::vector<bool> in C++ is specialized and consumes only 1/8 space as you may have expected. However, as 8-bit bytes are usually the shortest available type in most implementations, thread-safety is not guaranteed. This could have caused significant trouble in my current project. How lucky I am to notice this interesting feature before I have actually encountered trouble.

Besides, std::bitset provides a fixed size bit array whose length is fixed at compile-time.