Can std.variant be used with std.container.rbtree?

vit vit at vit.vit
Sat Apr 2 10:04:49 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;
>
> [...]

Variant can contain any type => variant cannot assume attributes 
like pure nothrow @safe @nogc on its methods. RedBlackTree has 
nothrow dtor => Element type must have nothrow dtor => Variand 
need nothrow dtor... Similar for other methods.

Try use ```std.sumtype```.


More information about the Digitalmars-d-learn mailing list