您的位置:首页 > Web前端

Effective STL 18 avoid using vector<bool>

2017-08-27 16:38 417 查看
vector dosen’t satisfy the requirements of an STL constainer, you are best off not using it; and deque and biset are alternative data structures that will almost certainly satisfy your need for the capabilies promised by vector.

template <typename Allocator>
vector<bool, Allocator> {
public:
class reference {...};

reference operator[](size_type n);
...
};

vector<bool> v;
bool *pb = &v[0];   // error! the expression on the right is of type
// vector<bool>::reference*, not bool*
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: