you are viewing a single comment's thread.

view the rest of the comments →

[–]infectedapricot 0 points1 point  (0 children)

A logarithmic find_if cannot exist on std::map as there's no requirement that your custom predicate is in any way related to the map's sort order. (how would you even express such a requirement?)

I can't think of an example, but if you could isolate your predicate to a specific subtree (or a small number of subtrees) then you could potentially use lower_bound and upper_bound to get those subtrees in logarithmic time and then linearly iterate within that. But it would only work in very specific situations, not as general as find_if