如何在 C++ 中获取向量中的最大值或最小值?
我假设它与数组或多或少相同,我错了吗?
我需要一个迭代器,对吧?我尝试使用 max_element
,但我一直收到错误消息。
vector<int>::const_iterator it;
it = max_element(cloud.begin(), cloud.end());
error: request for member ‘begin’ in ‘cloud’, which is of non-class type ‘int [10]’
原文由 bob blob 发布,翻译遵循 CC BY-SA 4.0 许可协议
代表作者回答
其中
cdf
是一个向量。