absl::c_nth_element

c_nth_element overloads

Synopses

Declared in <absl/algorithm/container.h>

Container-based version of the <algorithm> std::nth_element() function to rearrange the elements within a container such that the nth element would be in that position in an ordered sequence; other elements may be in any order, except that all preceding nth will be less than that element, and all following nth will be greater than that element.

template<typename RandomAccessContainer>
constexpr
void
c_nth_element(
    RandomAccessContainer& sequence,
    /* implementation-defined */ nth);
» more...

Overload of c_nth_element() for performing a comp comparison other than the default operator<.

template<
    typename RandomAccessContainer,
    typename LessThan>
constexpr
void
c_nth_element(
    RandomAccessContainer& sequence,
    /* implementation-defined */ nth,
    LessThan&& comp);
» more...

Parameters

NameDescription
sequenceThe container to rearrange.
nthAn iterator to the element to place in its sorted position.
compThe comparison used to order the elements.