<flat_map> and <flat_set> have very different implementations of _Emplace_hint(). They should be unified (not literally into the same function, but into very similar code patterns modulo the key/mapped difference).
There may be ways to further simplify them (I think there's too much special-casing of _IsUnique but I'm not certain).