<div dir="ltr">It's not out of the question that span may acquire contiguous_range constructors for 20. That changes the picture in 2 dimensions. First it ties span with the machinery the Niall was trying to avoid. Second, though, it might make it more interesting for some of the low level decode and encode routines that we need for byte-sized data to be specified as span based, rather than ranges over constrained types.<br><br>UTF-16 often arrives packaged in a char array, or uint8_ts, or possibly as std::bytes, as that becomes more prevalent. We can't, or shouldn't, alias those to char16_t or wchar_t or such. IO, at root, is octets these days. <br><br>The downside of span is of course state on underrun on input or overrun on output. Not insurmountable, but more difficult. <br><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 29, 2019 at 3:58 PM Niall Douglas <<a href="mailto:s_sourceforge@nedprod.com">s_sourceforge@nedprod.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">>> The reason why I really like span<T> for this is because reencoding<br>
>> benefits greatly from pipelining tricks only possible when input is<br>
>> guaranteed contiguous.<br>
>><br>
>> I also agree that support for discontiguous input (and output) is also<br>
>> very important.<br>
>><br>
>> But I'd tend to approach this as span-of-spans i.e. scatter-gather<br>
>> buffers with resumability. Or, precisely what LLFIO's read()/write()<br>
>> already implements.<br>
> <br>
> That approach would require reconstructing the outer span(s) whenever<br>
> the input is modified. That doesn't work well for some use cases (e.g.,<br>
> editors with undo buffers). Ranges offer the proper abstraction for<br>
> handling all of this transparently with optimum run-time performance.<br>
<br>
I'm actually advocating a low level API, and a high level API. Low level<br>
API works in terms of resumable span<CharT> (just one span, not span of<br>
spans). High level API's job is to generate as-long-as-possible<br>
span<CharT> calls to the low level API, in order to maximise performance.<br>
<br>
As I say, I'll return to path_view development after Belfast. I'll see<br>
what sort of low level API I can come up with intended for easier<br>
implementation of the high level API.<br>
<br>
Niall<br>
_______________________________________________<br>
SG16 Unicode mailing list<br>
<a href="mailto:Unicode@isocpp.open-std.org" target="_blank">Unicode@isocpp.open-std.org</a><br>
<a href="http://www.open-std.org/mailman/listinfo/unicode" rel="noreferrer" target="_blank">http://www.open-std.org/mailman/listinfo/unicode</a><br>
</blockquote></div>