digitalmars.D.learn - Function signature constraint syntax
- H. S. Teoh (13/13) Feb 02 2012 Quick question: I have a function that takes an alias parameter:
- Daniel Murphy (3/17) Feb 02 2012 void func(alias G)(object O) if (is(typeof(G(O)) == void)) {
- H. S. Teoh (6/31) Feb 03 2012 No, the problem was that G takes another type as parameter, not
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 that G should take a parameter of type X and return void? T -- When solving a problem, take care that you do not become part of the problem.
Feb 02 2012
void func(alias G)(object O) if (is(typeof(G(O)) == void)) { "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message news:mailman.295.1328245356.25230.digitalmars-d-learn puremagic.com...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 that G should take a parameter of type X and return void? T -- When solving a problem, take care that you do not become part of the problem.
Feb 02 2012
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" <hsteoh quickfur.ath.cx> wrote in message news:mailman.295.1328245356.25230.digitalmars-d-learn puremagic.com...-- Without geometry, life would be pointless. -- VSQuick 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 that G should take a parameter of type X and return void? T -- When solving a problem, take care that you do not become part of the problem.
Feb 03 2012