C++ std::map equivalent? (An in-order iterable associative container)

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 4 14:40:03 PDT 2014


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


More information about the Digitalmars-d-learn mailing list