How to work with an "arbitrary input range"?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Oct 21 17:11:12 PDT 2010
On Thursday, October 21, 2010 16:56:48 Simen kjaeraas wrote:
> Adam D. Ruppe <destructionator at gmail.com> wrote:
>
> [snip]
>
> > Anyway, what's the right thing to do here?
>
> I'd say:
>
> void fun( T )( T t ) if ( isInputRange!T && is( ElementType!T == dchar ) )
> {}
Though I'd suggest using Unqual!(ElementType!T). I'm not sure that it's
necessary in this case (sinc ElementType!() is already cheating on string
types), but I have found that if you want stuff to work with templates when
dealing with const and/or immutable, you really need to watch out for places to
use Unqual!().
- Jonathan M Davis
More information about the Digitalmars-d
mailing list