Re: Using decodeFront with a generalised input range

2018-11-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 9, 2018 5:22:27 AM MST Vinay Sajip via Digitalmars-d- learn wrote: > On Friday, 9 November 2018 at 11:24:42 UTC, Jonathan M Davis > > wrote: > > decode and decodeFront are for converting a UTF code unit to a > > Unicode code point. So, you're taking UTF-8 code unit (char), > > U

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Vinay Sajip via Digitalmars-d-learn
On Friday, 9 November 2018 at 11:24:42 UTC, Jonathan M Davis wrote: decode and decodeFront are for converting a UTF code unit to a Unicode code point. So, you're taking UTF-8 code unit (char), UTF-16 code unit (wchar), or a UTF-32 code unit (dchar) and decoding it. In the case of UTF-32, that's

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, November 9, 2018 3:45:49 AM MST Vinay Sajip via Digitalmars-d- learn wrote: > On Friday, 9 November 2018 at 10:26:46 UTC, Dennis wrote: > > On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote: > >> std.utf.decodeFront(Flag useReplacementDchar = > >> No.useReplacementDchar, S)(r

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 November 2018 at 10:45:49 UTC, Vinay Sajip wrote: As I see it, a ubyte 0x20 could be decoded to an ASCII char ' ', and likewise to wchar or dchar. It doesn't (to me) make sense to decode a char to a wchar or dchar. Anyway, you've shown me how decodeFront can be used, so great! Th

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Vinay Sajip via Digitalmars-d-learn
On Friday, 9 November 2018 at 10:26:46 UTC, Dennis wrote: On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote: std.utf.decodeFront(Flag useReplacementDchar = No.useReplacementDchar, S)(ref S str) if (isInputRange!S && isSomeChar!(ElementType!S)) This is the overload you want, let's

Re: Using decodeFront with a generalised input range

2018-11-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote: std.utf.decodeFront(Flag useReplacementDchar = No.useReplacementDchar, S)(ref S str) if (isInputRange!S && isSomeChar!(ElementType!S)) This is the overload you want, let's check if it matches: ref S str - your InputRange can be pas