Using input ranges with std.regex?

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Apr 25 14:43:06 PDT 2012


On 25.04.2012 23:08, H. S. Teoh wrote:
> Does std.regex support input ranges to match()? Or do I need to convert
> to string first?
>

For now, yes you have to convert them. Any random access range of code 
units should do the trick but stringish template constraints might kill 
that.

I plan to extend this eventually. The problematic point is that match 
internally is delimited by integer offsets (indices). Forward ranges 
technically can work (the match then will return something like 
take(..., n);) with a bunch of extra .save calls. Input ranges can't be 
used at all.



-- 
Dmitry Olshansky


More information about the Digitalmars-d-learn mailing list