On Thu, 2 Mar 2023 at 05:40, François Dumont via Libstdc++
<libstd...@gcc.gnu.org> wrote:
>
> Just forget about this patch, bad idea.
>
> The key_type might have additional data not used for the comparison.
> This data would not be preserved if we were inserting the already stored
> equivalent key instead of the user provided.

Right. Key equivalence does not imply substitutability, or even equality.

struct Key {
  int i = 0;
  int j = 0;
  bool operator<(const Key& k) const { return i < k.j; }
  bool operator==(const Key& k) const { return i == k.i && j == k.j; }
};

Reply via email to