Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
min_element
Prototype

template<class ForwardRange>
typename range_iterator<ForwardRange>::type
min_element(ForwardRange& rng);

template<class ForwardRange>
typename range_iterator<const ForwardRange>::type
min_element(const ForwardRange& rng);

template<class ForwardRange, class BinaryPredicate>
typename range_iterator<ForwardRange>::type
min_element(ForwardRange& rng, BinaryPredicate pred);

template<class ForwardRange, class BinaryPredicate>
typename range_iterator<const ForwardRange>::type
min_element(const ForwardRange& rng, BinaryPredicate pred);


template<
    range_return_value re,
    class ForwardRange
    >
typename range_return<ForwardRange, re>::type
min_element(ForwardRange& rng);

template<
    range_return_value_re,
    class ForwardRange
    >
typename range_return<const ForwardRange, re>::type
min_element(const ForwardRange& rng);

template<
    range_return_value re,
    class ForwardRange,
    class BinaryPredicate
    >
typename range_return<ForwardRange, re>::type
min_element(ForwardRange& rng, BinaryPredicate pred);

template<
    range_return_value re,
    class ForwardRange,
    class BinaryPredicate
    >
typename range_return<const ForwardRange, re>::type
min_element(const ForwardRange& rng, BinaryPredicate pred);

Description

The versions of min_element that return an iterator, return the iterator to the minimum value as determined by using operator< if a predicate is not supplied. Otherwise the predicate pred is used to determine the minimum value. The versions of min_element that return a range_return, defines found in the same manner as the returned iterator described above.

Definition

Defined in the header file boost/range/algorithm/min_element.hpp

Requirements

For the non-predicate versions:

For the predicate versions:

Complexity

Linear. Zero comparisons if empty(rng), otherwise distance(rng) - 1 comparisons.


PrevUpHomeNext