1*max_element(a.begin(), a.end());
1auto max = *max_element(vector.begin(), vector.end());
1#include <iostream>
2#include <algorithm>
3
4template <typename T, size_t N> const T* mybegin(const T (&a)[N]) { return a; }
5template <typename T, size_t N> const T* myend (const T (&a)[N]) { return a+N; }
6
7int main()
8{
9 const int cloud[] = { 1,2,3,4,-7,999,5,6 };
10
11 std::cout << *std::max_element(mybegin(cloud), myend(cloud)) << '\n';
12 std::cout << *std::min_element(mybegin(cloud), myend(cloud)) << '\n';
13}
1auto it = max_element(std::begin(cloud), std::end(cloud)); // c++11
1template <typename T, size_t N> const T* mybegin(const T (&a)[N]) { return a; }
2template <typename T, size_t N> const T* myend (const T (&a)[N]) { return a+N; }