Bugs in template constraints

Philippe Sigaud philippe.sigaud at gmail.com
Tue Aug 3 13:23:22 PDT 2010


On Tue, Aug 3, 2010 at 22:04, Andrej Mitrovic <andrej.mitrovich at gmail.com>wrote:

> Oh and there's a shorter way to write this example, by using isInputRange
> from std.range, like so:
>
> if (isInputRange!R && is(typeof({x = fun(x, range.front);})))
>

Does this work, without the () after the } ?


> This was in TDPL (except the {}'s which are missing).


As I said, abstracting away common constraints is a common trick. Have a
look at std.range, you'll see a bunch of these.


Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20100803/d8a7bc97/attachment.html>


More information about the Digitalmars-d mailing list