Closed slavenf closed 2 years ago
Voting this up. I just stumbled about this problem; it used to be in the library, but got removed at one point and when I updated to the current version my code wouldn't compile any more.
@dixlorenz There is workaround before martinus write better function. Openrobin_hood.h
. Somewhere near line 1869 is this:
std::pair<iterator, bool> insert(const value_type& keyval) {
ROBIN_HOOD_TRACE(this)
return emplace(keyval);
}
std::pair<iterator, bool> insert(value_type&& keyval) {
return emplace(std::move(keyval));
}
You can add these two functions:
iterator insert(const_iterator /*hint*/, const value_type& keyval)
{
return insert(keyval).first;
}
iterator insert(const_iterator /*hint*/, value_type&& keyval)
{
return insert(std::move(keyval)).first;
}
That should work.
If you need emplace_hint
then you can also add this:
template <typename... Args>
iterator emplace_hint(const_iterator /*hint*/, Args&&... args)
{
return emplace(std::forward<Args>(args)...).first;
}
Hi, thanks for being persitent :sweat_smile: I've created a new release with your fixes, thanks @slavenf!
Hello. Could you add overloaded member function
insert
with hint to be compatible with all standard container?For example, these overloads are very usefule in generic code that is using
std::insert_iterator
orstd::inserter
. Once again, thank you for this great library.