Generically call a function on Variant's payload?

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Mon Aug 20 00:33:06 UTC 2018


On 08/19/2018 08:27 PM, Nick Sabalausky (Abscissa) wrote:
> Suppose I've wrapped a Variant in a struct/class which ensures the 
> Variant *only* ever contains types which satisfy a particular constraint 
> (for example: isInputRange, or hasLength, etc...).
> 
> Is there a way to call a function (ex: popFront) on the Variant, 
> *without* knowing ahead of time all the possible static types it might 
> might contain?

Maybe something involving using Variant.coerce to convert the payload to 
a single common type? Not sure how I would do that though.


More information about the Digitalmars-d-learn mailing list