gpt4 book ai didi

c++ - std::array 与 std::vector 的行为

转载 作者:可可西里 更新时间:2023-11-01 15:16:52 28 4
gpt4 key购买 nike

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 数组,而不是任何类型的位集。

关于c++ - std::array<bool> 与 std::vector<bool> 的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44607389/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com