gpt4 book ai didi

c++ - 引用 C++11 的 STL 容器

转载 作者:太空狗 更新时间:2023-10-29 23:21:17 27 4
gpt4 key购买 nike

我知道这个问题被问过一百万次。大多数答案只是说对象应该是 CopyAssignable 和 CopyConstructible。但是documentation清楚地说这是规则(直到 C++11)!但它仍然不起作用。为什么?

最佳答案

是的,现在要求不那么严格了。但是,在您引用的部分下方,链接的文档明确指出:

The requirements that are imposed on the elements depend on the actual operations performed on the container. Generally, it is required that element type is a complete type and meets the requirements of Erasable, but many member functions impose stricter requirements. (since C++11)

引用不符合可删除的要求,因此它们仍然无法工作。

关于c++ - 引用 C++11 的 STL 容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33144419/

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