Variant.type bug ?

Voitech via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 23 12:40:08 PDT 2016


On Wednesday, 23 March 2016 at 19:18:50 UTC, Chris Wright wrote:
> Consider the `coerce` method: 
> http://dpldocs.info/experimental-docs/std.variant.VariantN.coerce.html
>
> Example:
>
> import std.variant;
> class A {}
> class B : A {}
>
> void main()
> {
>     A b = new B;
>     auto bb = Variant(b).coerce!B;
>     assert (bb !is null);
> }

Magnificent! Thank you ! :)


More information about the Digitalmars-d-learn mailing list