The API for c10::Dict
insert method is:
* Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key.
* May invalidate any references, pointers, or iterators referring to contained elements.
*
* @return A pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool denoting whether the insertion took place.
*/
template<class Key_, class Value_>
std::pair<iterator, bool> insert(Key_&& key, Value_&& value) const;
What’s the meaning of the const
qualifier? The dict does not stay const but might be modified.
As reference, the insert
method of std::dict
is not const: std::map<Key,T,Compare,Allocator>::insert - cppreference.com