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 an
object and strings are already objects.

No, but with a template you could easily make your own:

class Boxed(T) {
    T _v;
    alias _v this;
    this(in T v) immutable {_v = v;};
};

auto i = new Boxed!int(6);

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

Reply via email to