April 05, 2009
Andrei Alexandrescu Wrote:

> interface Interface { void foo(); }
> void foo(T : Interface)() { ... }
> class C { void foo(); }
> 
> C does not explicitly declare abiding to Interface. However, structurally it does. Should foo be called? If interface is meant for binary binding, no. If interface is meant for concept checking, maybe.

Interface[] rg;
interface Interface { void foo(); }
void foo(T : Interface)(T i) { rg~=i; }
class C { void foo(); }

What should happen here? Template will accept C and give error?
Top | Discussion index | About this forum | D home