We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vector::reserve
那么是不是可以直接确定好vector的大小,不让它在动态扩容了
原来的代码通过在构造函数中设置大小,导致后面过程非常繁琐。 应该考虑使用无参构造函数定义结果队列 que,然后用 que.reserve(people.size()); 语句一次性分配空间,指定 capacity!
que
que.reserve(people.size());
The text was updated successfully, but these errors were encountered:
No branches or pull requests
原来的代码通过在构造函数中设置大小,导致后面过程非常繁琐。
应该考虑使用无参构造函数定义结果队列
que
,然后用que.reserve(people.size());
语句一次性分配空间,指定 capacity!The text was updated successfully, but these errors were encountered: