Can std.variant be used with std.container.rbtree?
JG
someone at simewhere.com
Sat Apr 2 10:03:19 UTC 2022
On Friday, 1 April 2022 at 22:22:21 UTC, Vijay Nayar wrote:
> Consider the following program:
> ```d
> void main()
> {
> import std.stdio;
> import std.container.rbtree;
> import std.variant;
>
> [...]
You need an order on the elements in a red black tree. Am I
correct in thinking you want a container of the form given a key
(a string) recover some data (of different types). If so make the
elements you store in the red black tree tuples (k,d) where k is
a string and d is a variant. Define the order (k1,d1)<(k2,d2) if
k1<k2. Make sure to allo duplicates. The when you search for a
key you get the pair and take the second part. I hope this makes
sense.
More information about the Digitalmars-d-learn
mailing list