Search code examples
c++stdarray

Why `std::array` doesn't offer bit packing for boolean values like what `std::vector` does?


As far as I know std::array doesn't pack bits for boolean values like bitset but std::vector does, but I cannot find any explanation for this online.

Why did the C++ developers decide not to do this?


Solution

  • Q: Why does std::vector pack bits?
    A: Poor design.

    Q: Why doesn't std::array pack bits?
    A: Learned from the previous mistake.