From cppreference, it is said the complexity of std::map::emplace_hint is:
Complexity
Logarithmic in the size of the container in general, but amortized constant if the new element is inserted just before hint.
Why it is constant if we provide a good hint?