The behavior of std :: array <bool> vs. std :: vector <bool>

Does it use std::array<bool>the same memory optimization for package packaging as it std::vector<bool>does?

Thanks!

+6
source share
1 answer

No, std::arrayit has no specialization for type bool.

You can find more details here , but basically std::arrayit is simple:

aggregate type with the same semantics as the structure containing the C-style array T [N]

and in the case of bool, you can consider it as an array of B-type types, and not some bit-set.

+7
source

All Articles