TCR icon indicating copy to clipboard operation
TCR copied to clipboard

increasing_function should overwrite on insert

Open RagnarGrootKoerkamp opened this issue 7 years ago • 1 comments

std::insert doesn't overwrite, while we need this to update an existing index to a better value. Just using m[x] works, but is much slower.

https://github.com/TimonKnigge/TCR/blob/master/snippets/datastructures/increasing_function.cpp#L12

RagnarGrootKoerkamp avatar Dec 02 '18 13:12 RagnarGrootKoerkamp

Are you really that worried about the performance of m[x] = y? I'm also a bit uncomfortable with this hint parameter by the way, since apparently it behaves differently until C++11 then in C++11 and later [1].

[1] https://en.cppreference.com/w/cpp/container/set/insert

TimonKnigge avatar Dec 03 '18 11:12 TimonKnigge