boost::gil::histogram::insert_or_assign

Attempts to insert a std::pair into the %unordered_map.

Synopsis

Declared in <boost/gil/histogram.hpp>

template<typename _Obj>
iterator
insert_or_assign(
    const_iterator __hint,
    key_type const& __k,
    _Obj&& __obj);

Description

This function is not concerned about whether the insertion took place, and thus does not return a boolean like the single‐argument insert() does. If the %pair was already in the %unordered map, the .second of the %pair is assigned from __obj. Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting.

Insertion requires amortized constant time.

Return Value

An iterator that points to the element with key of __x (may or may not be the %pair passed in).

Parameters

Name

Description

__hint

An iterator that serves as a hint as to where the pair should be inserted.

__k

Key to use for finding a possibly existing pair in the unordered_map.

__obj

Argument used to generate the .second for a pair instance.

Created with MrDocs