On Sunday, 4 May 2014 at 21:40:04 UTC, bearophile wrote:
Mark Isaacson:

2) Create a wrapper struct that contains key and value and whose comparison operator is defined only on the key. This would essentially be doing what the C++ implementation does.

Until we have a tree-based associative map, use a tuple for the key-value and define a "less" template argument like q{a.key < b.key} or q{a[0] < b[0]}.

Bye,
bearophile

What benefits this gives over definining distinct struct? Sounds like unnecessary complication for me.

Reply via email to