gpt4 book ai didi

c++ - 错误 : 'sort' is not a member of 'std'

转载 作者:IT老高 更新时间:2023-10-28 22:22:59 29 4
gpt4 key购买 nike

我只是想问一下这个错误是什么意思以及如何解决它谢谢!

error: 'sort' is not a member of 'std'

vector<int> result;
for (auto & i : numbers)
result.push_back(std::stoi(i));
std::sort(result.begin(), result.end());

最佳答案

包括算法头。这就是出现错误的原因。

#include <algorithm>

关于c++ - 错误 : 'sort' is not a member of 'std' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31159302/

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