Topic: string_views into ropes and other stringlike objects


Author: Magnus Fromreide <magfr@lysator.liu.se>
Date: Tue, 17 Dec 2013 02:45:44 +0100
Raw View
Hello.

I have been curious about why string_view defines it's pointer_type to be
const charT* and not some iterator with value_type charT.

Doing this would allow non-contigous strings, like e.g. ropes, as underlying
types for string_views.

I will admit that one can of worms that such a change do open up is if the
iterator is less capable than a RandomAccess-iterator.

/MF

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Mon, 16 Dec 2013 19:59:26 -0600
Raw View
--f46d04428ca09cbeee04edb1490a
Content-Type: text/plain; charset=ISO-8859-1

On 16 December 2013 19:45, Magnus Fromreide <magfr@lysator.liu.se> wrote:

> Doing this would allow non-contigous strings, like e.g. ropes, as
> underlying
> types for string_views.
>

Wouldn't that require a type erased (and hence slow, need allocator
support, etc.) iterator?

If people want another type that can hold any arbitrary sequential
container of char, I'd suggest a separate proposal, as that is far beyond
what string_view is for.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--f46d04428ca09cbeee04edb1490a
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On 16 December 2013 19:45, Magnus Fromreide <span dir=3D"l=
tr">&lt;<a href=3D"mailto:magfr@lysator.liu.se" target=3D"_blank">magfr@lys=
ator.liu.se</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=
=3D"gmail_quote">

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Doing this would allow non-contigous strings=
, like e.g. ropes, as underlying<br>
types for string_views.<br></blockquote><div><br></div><div>Wouldn&#39;t th=
at require a type erased (and hence slow, need allocator support, etc.) ite=
rator?</div><div><br></div><div>If people want another type that can hold a=
ny arbitrary sequential container of char, I&#39;d suggest a separate propo=
sal, as that is far beyond what string_view is for.</div>

</div>-- <br>=A0Nevin &quot;:-)&quot; Liber=A0 &lt;mailto:<a href=3D"mailto=
:nevin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>&gt;=
=A0 (847) 691-1404
</div></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--f46d04428ca09cbeee04edb1490a--

.


Author: Marshall Clow <mclow.lists@gmail.com>
Date: Tue, 17 Dec 2013 10:01:10 -0800
Raw View
On Dec 16, 2013, at 5:45 PM, Magnus Fromreide <magfr@lysator.liu.se> wrote:

> Hello.
>=20
> I have been curious about why string_view defines it's pointer_type to be
> const charT* and not some iterator with value_type charT.
>=20
> Doing this would allow non-contigous strings, like e.g. ropes, as underly=
ing
> types for string_views.

Because string_view is a limited proposal, rather than a general proposal.
It has a defined use case, and attempts to fill those uses.

A (iterator, length) or (iterator, iterator) data structure is much more ge=
neral,
less efficient in some common use cases, and (as you pointed out) the first=
 one
fails badly on non-Random Access iterators.

There is a study group (SG9; Ranges) that is supposed to be working on a
general solution.

=97 Marshall


--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.