several types in one Array ?

Mil58 peter_pinkness at yahoo.fr
Thu Oct 17 15:41:14 UTC 2019


On Thursday, 17 October 2019 at 14:50:23 UTC, Paul Backus wrote:
> On Thursday, 17 October 2019 at 14:45:24 UTC, Mil58 wrote:
>> Hi all...
>> Does exist (or not?) a way to create array with several types 
>> (as in Python)
>>  (example) :
>>   xxx[4] myTab = [180, "John", false, -0.771];
>>
>> Of course, this is doing an Error ;-)   Thanks.
>
> import std.variant;
> Variant[4] myTab = variantArray(180, "John", false, -0.771);
>
> Documentation: https://dlang.org/phobos/std_variant.html

T h a n ks    for this(quick) reply :)


More information about the Digitalmars-d-learn mailing list