On Saturday, 7 October 2017 at 10:36:21 UTC, drug wrote:
07.10.2017 13:31, user1234 пишет:
Since the compiler has the ability to detect input ranges in
the foreach aggregate that are aggregates implementing the
right primitives, why don't you set the widely used
std.range.isInputRange as a __trait, e.g
__traits(isInputRange, Stuff) ?
IIRC the reason is if something could be done in library it
should be done in library. Just to avoid making compiler more
complex than it's necessary.
The point is that it's **already** in the compiler and that it
could save hundreds of template instantiation.
As for me isInputRange!Stuff is better than
__traits(isInputRange, Stuff).
Yeah of course, for code cosmetic it could be wrapped in an
templatized enum
enum isInputRange(T) = __traits(isInputRangeInternal, T);