On Tue, Dec 02, 2014 at 08:11:52PM -0500, Steven Schveighoffer via 
Digitalmars-d wrote:
> On 12/2/14 6:28 PM, H. S. Teoh via Digitalmars-d wrote:
> 
> >Technically, you *can* do that, but it's a lot more verbose (plus,
> >ddoc doesn't know how to generate docs for eponymous templates
> >properly and it looks ugly):
> >
> >     template method(R)
> >     {
> >             import std.range : isInputRange;
> >
> >             void method(R range)
> >                     if (isInputRange!R)
> >             { ... }
> >     }
> 
> That works? I wouldn't expect it to, since the method inside the
> template is not a template.
[...]

Argh, you're right, that doesn't compile. The sig constraint has to be
turned into a static if, which has different semantics, or attached to
the template declaration, which defeats the purpose. :-(


T

-- 
An elephant: A mouse built to government specifications. -- Robert Heinlein

Reply via email to