## CGAL::max_element_if

### Definition

The function max_element_if computes the maximum among the elements of a range which satisfy a certain predicate. It is modeled after the STL function max_element.

#include <CGAL/algorithm.h>

template < class ForwardIterator, class Predicate >

ForwardIterator

max_element_if ( | ForwardIterator first, ForwardIterator last, Predicate pred)

|  | returns an iterator referring to the maximal element among those satifying the predicate pred in the range [first, last). The ordering is defined by the operator< on VT where VT is the value type of ForwardIterator. Requirement: pred is an unary function object: VT bool.
template < class ForwardIterator, class Compare, class Predicate >

ForwardIterator

max_element_if ( | ForwardIterator first, ForwardIterator last, Compare comp, Predicate pred)

|  | return an iterator referring to the maximal element among those satifying the predicate pred in the range [first, last). The ordering is defined by comp. Requirement: comp is a binary function object: VT × VT bool where VT is the value type of ForwardIterator. pred is an unary function object: VT bool.

### See Also

CGAL::min_element_if
CGAL::min_max_element