Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 446 Bytes

max_element.md

File metadata and controls

15 lines (11 loc) · 446 Bytes

max_element

Description : Returns an iterator to the greatest element in a range defined by [first, last).

Example:

    std::vector<int> vec = {3, -1, 2, 10, 4};

    auto greatestIt = std::max_element(vec.begin(), vec.end()); 
    // prints 10
    std::cout << "The greatest element is " << *greatestIt << '\n';

See Sample code Run Code