inout and templates don't mix...
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Mar 23 15:25:07 PDT 2016
On 03/23/2016 02:31 PM, cy wrote:
> struct Someop(Type) {
> Type thing;
> void foo() {
> thing.bar();
> }
> }
>
> struct Foo {
> void bar() {
> import std.stdio: writeln;
> writeln("bar");
> }
> }
>
> struct Bar {
> void thingy(inout(Foo) foo) inout {
> auto op = Someop(foo);
The following is a workaround for this example:
auto op = Someop!Foo(foo);
I'm not sure whether Someop's implicit constructor should take part in
deducing Someop's Type template parameter.
Ali
More information about the Digitalmars-d-learn
mailing list