C++ std::map equivalent? (An in-order iterable associative container)
Dicebot via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun May 4 15:19:33 PDT 2014
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.
More information about the Digitalmars-d-learn
mailing list