Symbol lookup rules and imports

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Tue Dec 2 18:28:51 PST 2014


On Tue, 2 Dec 2014 17:33:09 -0800
"H. S. Teoh via Digitalmars-d" <digitalmars-d at puremagic.com> wrote:

> 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. :-(
heh, i was sure that this works too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20141203/b8bede8e/attachment.sig>


More information about the Digitalmars-d mailing list