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);

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);

Return Value

An iterator to the inserted element.

Parameters

Name

Description

container

The sorted container to insert into.

value

The value to insert.

comp

The comparator the container is sorted by.

first

The beginning of the sorted subrange to search.

last

The end of the sorted subrange to search.

Created with MrDocs