What's the current phobos way to define generic data sources and sinks?

Hannes Steffenhagen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 17 18:30:00 PDT 2014


I've never said anything about inheriting from InputRange, just
that I'd take an InputRange as a parameter. Anyway I changed my
signature to

Result parse(T)(T lines) if(isInputRange!T && is(ElementType!T ==
string));

Still not sure if that's the best way to do it, but it definitely
is the one that proved to be the least hassle to use for my
simple test cases.


More information about the Digitalmars-d-learn mailing list