On 02/07/2011 01:07 PM, Torarin wrote:
If you want to use an interface as a concept, you can take kenji's
adaptTo module and add this:

template conformsTo(T, Interfaces...)
{
  enum conformsTo = AdaptTo!Interfaces.hasRequiredMethods!T;
}

and use it like this

void draw(T)(T shape) if (conformsTo!(T, Shape, Drawable))

This will of course only work for methods, not properties or aliases,
so you still need constraints in some cases.

That's nice, thank you.

Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to