mrdocs::insertSorted

insertSorted overloads

Synopses

Declared in <mrdocs/Support/Container/Algorithm.hpp>

Insert a value into a range sorted by a comparator.

template<
    std::ranges::range Container,
    class T,
    class Comp>
auto
insertSorted(
    Container& container,
    T&& value,
    Comp comp);
» more...

Insert a value into a range sorted by a comparator, searching only a subrange of it.

template<
    class Container,
    std::forward_iterator It,
    class T,
    class Comp>
auto
insertSorted(
    Container& container,
    It first,
    It last,
    T&& value,
    Comp comp);
» more...

Return Value

An iterator to the inserted element.

Parameters

NameDescription
containerThe sorted container to insert into.
valueThe value to insert.
compThe comparator the container is sorted by.
firstThe beginning of the sorted subrange to search.
lastThe end of the sorted subrange to search.