Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

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