More type-flexible arrays?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 13 23:43:48 PDT 2015


On Sun, 14 Jun 2015 06:12:29 +0000, Ozan wrote:

> Hallo!
> 
> Is it possible to create arrays which has more then one type,
> f. ex. array[0] = 1; array[1] = "z"; array[2] = new clazz(), ....
> 
> I tried "Variant", but it slow down heavily my app.

it is possible. with Variant. ;-)

chances are that you're doing something by the wrong way in your code. 
not syntactically wrong, but algorithmically wrong. why to you need such 
an array? weak typing is slow. strong typing is fast. seems that you are 
used to scripting languages with weak typing, and designed your algorithm 
with weak typing in mind. i think it's better to try to redesign your 
algorithm, not looking for faster weak typing solution.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150614/ee1e2d7f/attachment.sig>


More information about the Digitalmars-d-learn mailing list