C#'s greatest mistakes
Torarin
torarind at gmail.com
Sat Nov 27 22:17:08 PST 2010
2010/11/28 Michel Fortin <michel.fortin at michelf.com>:
> Well, if you consider the previously discussed 'adaptTo' function template,
> all types can be adapted to an interface (via a template-generated wrapper
> class). So "implements" for structs isn't too far off, as you can use the
> struct to implement the interface via 'adaptTo'.
Actually, adaptTo already uses such a template internally. So I would
suggest to just add this:
template conformsTo(T, Interfaces...)
{
enum conformsTo = AdaptTo!Interfaces.hasRequiredMethods!T;
}
More information about the Digitalmars-d
mailing list