return type based on content of an array

thorstein torsten.lange at mail.de
Wed Feb 21 06:45:14 UTC 2018


Hi,

I'm going circles... ;) I read a string that contains an array of 
unknown dimension like:
a = [1,2,3,4] or
a = [[1,2],[3,4]] or
a = [[[1,2],[3,4]],[[5,6],[7,8]]]

With that I want to perform specified operations e.g. also 
provided on command line.

Because at compile time the dimension of the array is unkown I 
did not find any possibility to do something like:

auto arr = func(a);

where 'auto func(string str)' should return either a 1D, 2D, 3D 
array and arr is not locked in an if(){} scope.

Is there any way and What should I'm looking for?

Thanks, thorstein




More information about the Digitalmars-d-learn mailing list