How can I get the maximum or minimum value in a vector in C++?
And am I wrong in assuming it would be more or less the same with an array?
I need an iterator, right? I tried it with max_element
, but I kept getting an error.
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]’