Equivalents to policy classes in D

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Apr 19 19:41:21 PDT 2012


On 4/20/12, Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> wrote:
> void main()
> {
> 	auto oneOne = MyStruct!(size_t, GenOne, WriteOne);
> 	auto oneTwo = MyStruct!(double, GenOne, WriteTwo);
> 	auto threeOne = MyStruct!(double, GenThree, WriteOne);
> 	auto threeTwo = MyStruct!(long, GenThree, WriteTwo);
> }

You're doing the equivalent of:
auto one = Foo;
but you need:
auto one = Foo();

so:
auto oneOne   = MyStruct!(size_t, GenOne, WriteOne)();
auto oneTwo   = MyStruct!(double, GenOne, WriteTwo)();
auto threeOne = MyStruct!(double, GenThree, WriteOne)();
auto threeTwo = MyStruct!(long, GenThree, WriteTwo)();


More information about the Digitalmars-d-learn mailing list