Re: Does D have object wrappers for primitives?

2016-07-30 Thread Cauterite via Digitalmars-d-learn
On Saturday, 30 July 2016 at 04:12:45 UTC, stunaep wrote: Thank you. This is just what I needed. I am curious though as to why this doesn't work with strings. It would work if I removed immutable from the Boxed constructor but I thought strings were immutable. I get a compiler error 'not

Re: Does D have object wrappers for primitives?

2016-07-29 Thread stunaep via Digitalmars-d-learn
On Friday, 29 July 2016 at 20:25:16 UTC, Cauterite wrote: On Friday, 29 July 2016 at 20:13:34 UTC, stunaep wrote: I have some java code I need to convert and at one point it uses an Object[] array to store various ints, longs, and strings. Java has built in Integer and Long classes that wrap

Re: Does D have object wrappers for primitives?

2016-07-29 Thread Ali Çehreli via Digitalmars-d-learn
On 07/29/2016 01:40 PM, Cauterite wrote: > On Friday, 29 July 2016 at 20:26:47 UTC, Ali Çehreli wrote: >> >> I was going to suggest Algebraic because it allows arrays of mixed >> primitive types (wrapped in Algebraic): >> >> https://dlang.org/phobos/std_variant.html#.Algebraic >> >> Ali > > It

Re: Does D have object wrappers for primitives?

2016-07-29 Thread Cauterite via Digitalmars-d-learn
On Friday, 29 July 2016 at 20:26:47 UTC, Ali Çehreli wrote: I was going to suggest Algebraic because it allows arrays of mixed primitive types (wrapped in Algebraic): https://dlang.org/phobos/std_variant.html#.Algebraic Ali It could work, but keep in mind Algebraic is a structure, not

Re: Does D have object wrappers for primitives?

2016-07-29 Thread Ali Çehreli via Digitalmars-d-learn
On 07/29/2016 01:25 PM, Cauterite wrote: On Friday, 29 July 2016 at 20:13:34 UTC, stunaep wrote: I have some java code I need to convert and at one point it uses an Object[] array to store various ints, longs, and strings. Java has built in Integer and Long classes that wrap the primitives in

Re: Does D have object wrappers for primitives?

2016-07-29 Thread Cauterite via Digitalmars-d-learn
On Friday, 29 July 2016 at 20:13:34 UTC, stunaep wrote: I have some java code I need to convert and at one point it uses an Object[] array to store various ints, longs, and strings. Java has built in Integer and Long classes that wrap the primitives in an object and strings are already

Does D have object wrappers for primitives?

2016-07-29 Thread stunaep via Digitalmars-d-learn
I have some java code I need to convert and at one point it uses an Object[] array to store various ints, longs, and strings. Java has built in Integer and Long classes that wrap the primitives in an object and strings are already objects.