Function signature constraint syntax

2012-02-02 Thread H. S. Teoh
Quick question: I have a function that takes an alias parameter: struct X { ... }; void func(alias G)(object O) { ... X x = ...; G(x); ... } How do I write a signature constraint that essentially specifies th

Re: Function signature constraint syntax

2012-02-02 Thread Philippe Sigaud
> > Quick question: I have a function that takes an alias parameter: > >struct X { ... }; > >void func(alias G)(object O) { >... >X x = ...; >G(x); >... >} > > How do I write a signature constraint that essentia

Re: Function signature constraint syntax

2012-02-02 Thread Daniel Murphy
void func(alias G)(object O) if (is(typeof(G(O)) == void)) { "H. S. Teoh" wrote in message news:mailman.295.1328245356.25230.digitalmars-d-le...@puremagic.com... > Quick question: I have a function that takes an alias parameter: > > struct X { ... }; > > void func(alias G)(object O) { > ... > X

Re: Function signature constraint syntax

2012-02-03 Thread H. S. Teoh
On Fri, Feb 03, 2012 at 06:51:56AM +0100, Philippe Sigaud wrote: > > > > Quick question: I have a function that takes an alias parameter: > > > >struct X { ... }; > > > >void func(alias G)(object O) { > >... > >X x = ...; > >G(x); > >

Re: Function signature constraint syntax

2012-02-03 Thread H. S. Teoh
On Fri, Feb 03, 2012 at 04:50:24PM +1100, Daniel Murphy wrote: > void func(alias G)(object O) if (is(typeof(G(O)) == void)) { No, the problem was that G takes another type as parameter, not 'object'. --T > "H. S. Teoh" wrote in message > news:mailman.295.1328245356.25230.digitalmars-d-le...@p