std::array<bool> 与 std::vector<bool> 的行为
Behaviour of std::array<bool> vs. std::vector<bool>
std::array<bool>
是否实现了与 std::vector<bool>
相同的位封装内存优化?
谢谢!
否,std::array
没有 bool 类型的特化。
您可以找到更多详细信息 here,但是,基本上,std::array
只是一个:
an aggregate type with the same semantics as a struct holding a C-style array T[N]
并且在 bool 的情况下,您可能会将其视为 C 风格的 bool 数组,而不是任何类型的位集。
std::array<bool>
是否实现了与 std::vector<bool>
相同的位封装内存优化?
谢谢!
否,std::array
没有 bool 类型的特化。
您可以找到更多详细信息 here,但是,基本上,std::array
只是一个:
an aggregate type with the same semantics as a struct holding a C-style array T[N]
并且在 bool 的情况下,您可能会将其视为 C 风格的 bool 数组,而不是任何类型的位集。