my class, which is compatible with the ITransformer interface from the README
class PlusNumber {
private int number;
this(int number) {
this.number = number;
}
int transform(int i) pure const {
return i + number;
}
}
when instancing
auto plus = Transformer(new PlusNumber(42));
I get the following compile error
dlang/dmd-2.094.2/linux/bin64/../../src/phobos/std/conv.d(4706,9): Error: static assert: "Don't know how to initialize an object of type PlusNumber with arguments ()"
dlang/dmd-2.094.2/linux/bin64/../../src/phobos/std/conv.d(4785,21): instantiated from here: `emplace!(PlusNumber)`
dlang/dmd-2.094.2/linux/bin64/../../src/phobos/std/experimental/allocator/package.d(1174,56): instantiated from here: `emplace!(PlusNumber)`
.dub/packages/tardy-0.0.1/tardy/source/tardy/poly.d(417,33): instantiated from here: `make!(PlusNumber, GC)`
.dub/packages/tardy-0.0.1/tardy/source/tardy/poly.d(36,39): instantiated from here: `constructInstance!(PlusNumber, GC, PlusNumber)`
source/tardy_fun.d(77,33): instantiated from here: `__ctor!(Polymorphic!(ITransformer, GC), PlusNumber)`
However it DOES work when I change class to struct OR if i add a copy constructor this(PlusNumber other) to the class.
my class, which is compatible with the
ITransformer
interface from the READMEwhen instancing
I get the following compile error
However it DOES work when I change
class
tostruct
OR if i add a copy constructorthis(PlusNumber other)
to the class.Thx for your time!