How can I get the maximum or minimum value in a vector?
Using C++11/C++0x compile flags, you can auto it = max_element(std::begin(cloud), std::end(cloud)); // C++11 Otherwise, write your own: template <typename T, size_t N> const T* mybegin(const T (&a)[N]) { return a; } template <typename T, size_t N> const T* myend (const T (&a)[N]) { return a+N; } See it live at http://ideone.com/aDkhW: #include <iostream> #include <algorithm> … Read more