Topic: Overloaded member functions substr of the class


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 24 May 2018 06:19:43 -0700 (PDT)
Raw View
------=_Part_6129_819008180.1527167983904
Content-Type: multipart/alternative;
 boundary="----=_Part_6130_927824777.1527167983905"

------=_Part_6130_927824777.1527167983905
Content-Type: text/plain; charset="UTF-8"

At present the class template has only one member function *substr*
declared like

basic_string substr(size_type pos = 0, size_type n = npos) const;

As the class has iterators I would like to propose two overloads of the
function (or at least the first one):

basic_string substr( const_iterator first, const_iterator last ) const;


and

basic_string substr( const_reverse_iterator first, const_reverse_iterator
last ) const;

The last function builds a substring in the reverse order.

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40isocpp.org.

------=_Part_6130_927824777.1527167983905
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">At present the class template has only one member function=
 <b>substr</b> declared like<div><br></div><div><div class=3D"prettyprint" =
style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, =
187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#000;" class=3D"styled-by-prettify">basic_string substr</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">size_type pos </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" cla=
ss=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> size_type n </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> npos</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span></div></code></d=
iv><br>As the class has iterators I would like to propose two overloads of =
the function (or at least the first one):</div><div><br></div><div><div cla=
ss=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-co=
lor: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap:=
 break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">basic_string substr<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> const_iterator firs=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> const_iterator </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">last</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;"=
 class=3D"styled-by-prettify">const</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span></div></code></div><br></div><div><br></di=
v><div>and</div><div><br></div><div><div class=3D"prettyprint" style=3D"bac=
kground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border=
-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">basic_string substr</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> const_reverse_iterator first</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> const_reverse_iterator </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">last</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">const</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span></div></code></div><br></div><div>The last function build=
s a substring in the reverse order.</div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c=
%40isocpp.org</a>.<br />

------=_Part_6130_927824777.1527167983905--

------=_Part_6129_819008180.1527167983904--

.


Author: =?UTF-8?Q?Micha=C5=82_Dominiak?= <griwes@griwes.info>
Date: Thu, 24 May 2018 15:21:35 +0200
Raw View
--000000000000246217056cf3886c
Content-Type: text/plain; charset="UTF-8"

How is that *any* different from just using ctor (6) of basic_string? (
http://en.cppreference.com/w/cpp/string/basic_string/basic_string)

On Thu, May 24, 2018 at 3:19 PM 'Vlad from Moscow' via ISO C++ Standard -
Future Proposals <std-proposals@isocpp.org> wrote:

> At present the class template has only one member function *substr*
> declared like
>
> basic_string substr(size_type pos = 0, size_type n = npos) const;
>
> As the class has iterators I would like to propose two overloads of the
> function (or at least the first one):
>
> basic_string substr( const_iterator first, const_iterator last ) const;
>
>
> and
>
> basic_string substr( const_reverse_iterator first, const_reverse_iterator
> last ) const;
>
> The last function builds a substring in the reverse order.
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdR-m%2BCdMD4LqBNu5jkfHiGBsLBEGSpJPb0o%2B9FjnD655w%40mail.gmail.com.

--000000000000246217056cf3886c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">How is that <i>any</i>=C2=A0different from just using ctor=
 (6) of basic_string? (<a href=3D"http://en.cppreference.com/w/cpp/string/b=
asic_string/basic_string">http://en.cppreference.com/w/cpp/string/basic_str=
ing/basic_string</a>)</div><br><div class=3D"gmail_quote"><div dir=3D"ltr">=
On Thu, May 24, 2018 at 3:19 PM &#39;Vlad from Moscow&#39; via ISO C++ Stan=
dard - Future Proposals &lt;<a href=3D"mailto:std-proposals@isocpp.org">std=
-proposals@isocpp.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
"><div dir=3D"ltr">At present the class template has only one member functi=
on <b>substr</b> declared like<div><br></div><div><div class=3D"m_156553356=
0728507692prettyprint" style=3D"background-color:rgb(250,250,250);border-co=
lor:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-wo=
rd"><code class=3D"m_1565533560728507692prettyprint"><div class=3D"m_156553=
3560728507692subprettyprint"><span style=3D"color:#000" class=3D"m_15655335=
60728507692styled-by-prettify">basic_string substr</span><span style=3D"col=
or:#660" class=3D"m_1565533560728507692styled-by-prettify">(</span><span st=
yle=3D"color:#000" class=3D"m_1565533560728507692styled-by-prettify">size_t=
ype pos </span><span style=3D"color:#660" class=3D"m_1565533560728507692sty=
led-by-prettify">=3D</span><span style=3D"color:#000" class=3D"m_1565533560=
728507692styled-by-prettify"> </span><span style=3D"color:#066" class=3D"m_=
1565533560728507692styled-by-prettify">0</span><span style=3D"color:#660" c=
lass=3D"m_1565533560728507692styled-by-prettify">,</span><span style=3D"col=
or:#000" class=3D"m_1565533560728507692styled-by-prettify"> size_type n </s=
pan><span style=3D"color:#660" class=3D"m_1565533560728507692styled-by-pret=
tify">=3D</span><span style=3D"color:#000" class=3D"m_1565533560728507692st=
yled-by-prettify"> npos</span><span style=3D"color:#660" class=3D"m_1565533=
560728507692styled-by-prettify">)</span><span style=3D"color:#000" class=3D=
"m_1565533560728507692styled-by-prettify"> </span><span style=3D"color:#008=
" class=3D"m_1565533560728507692styled-by-prettify">const</span><span style=
=3D"color:#660" class=3D"m_1565533560728507692styled-by-prettify">;</span><=
/div></code></div><br>As the class has iterators I would like to propose tw=
o overloads of the function (or at least the first one):</div><div><br></di=
v><div><div class=3D"m_1565533560728507692prettyprint" style=3D"background-=
color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bor=
der-width:1px;word-wrap:break-word"><code class=3D"m_1565533560728507692pre=
ttyprint"><div class=3D"m_1565533560728507692subprettyprint"><span style=3D=
"color:#000" class=3D"m_1565533560728507692styled-by-prettify">basic_string=
 substr</span><span style=3D"color:#660" class=3D"m_1565533560728507692styl=
ed-by-prettify">(</span><span style=3D"color:#000" class=3D"m_1565533560728=
507692styled-by-prettify"> const_iterator first</span><span style=3D"color:=
#660" class=3D"m_1565533560728507692styled-by-prettify">,</span><span style=
=3D"color:#000" class=3D"m_1565533560728507692styled-by-prettify"> const_it=
erator </span><span style=3D"color:#008" class=3D"m_1565533560728507692styl=
ed-by-prettify">last</span><span style=3D"color:#000" class=3D"m_1565533560=
728507692styled-by-prettify"> </span><span style=3D"color:#660" class=3D"m_=
1565533560728507692styled-by-prettify">)</span><span style=3D"color:#000" c=
lass=3D"m_1565533560728507692styled-by-prettify"> </span><span style=3D"col=
or:#008" class=3D"m_1565533560728507692styled-by-prettify">const</span><spa=
n style=3D"color:#660" class=3D"m_1565533560728507692styled-by-prettify">;<=
/span></div></code></div><br></div><div><br></div><div>and</div><div><br></=
div><div><div class=3D"m_1565533560728507692prettyprint" style=3D"backgroun=
d-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;b=
order-width:1px;word-wrap:break-word"><code class=3D"m_1565533560728507692p=
rettyprint"><div class=3D"m_1565533560728507692subprettyprint"><span style=
=3D"color:#000" class=3D"m_1565533560728507692styled-by-prettify">basic_str=
ing substr</span><span style=3D"color:#660" class=3D"m_1565533560728507692s=
tyled-by-prettify">(</span><span style=3D"color:#000" class=3D"m_1565533560=
728507692styled-by-prettify"> const_reverse_iterator first</span><span styl=
e=3D"color:#660" class=3D"m_1565533560728507692styled-by-prettify">,</span>=
<span style=3D"color:#000" class=3D"m_1565533560728507692styled-by-prettify=
"> const_reverse_iterator </span><span style=3D"color:#008" class=3D"m_1565=
533560728507692styled-by-prettify">last</span><span style=3D"color:#000" cl=
ass=3D"m_1565533560728507692styled-by-prettify"> </span><span style=3D"colo=
r:#660" class=3D"m_1565533560728507692styled-by-prettify">)</span><span sty=
le=3D"color:#000" class=3D"m_1565533560728507692styled-by-prettify"> </span=
><span style=3D"color:#008" class=3D"m_1565533560728507692styled-by-prettif=
y">const</span><span style=3D"color:#660" class=3D"m_1565533560728507692sty=
led-by-prettify">;</span></div></code></div><br></div><div>The last functio=
n builds a substring in the reverse order.</div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-=
4eda-9435-388219d6f47c%40isocpp.org</a>.<br>
</blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAPCFJdR-m%2BCdMD4LqBNu5jkfHiGBsLBEGS=
pJPb0o%2B9FjnD655w%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdR-m%2B=
CdMD4LqBNu5jkfHiGBsLBEGSpJPb0o%2B9FjnD655w%40mail.gmail.com</a>.<br />

--000000000000246217056cf3886c--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 24 May 2018 06:28:54 -0700 (PDT)
Raw View
------=_Part_6157_1338658938.1527168535049
Content-Type: multipart/alternative;
 boundary="----=_Part_6158_239457122.1527168535050"

------=_Part_6158_239457122.1527168535050
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It is more expressive. For example a function uses a string and depending=
=20
on a condition either uses its own member functions and the current member=
=20
function substr or it uses standard algorithms and one of the overloaded=20
member functions substr with iterators.=20

In this case the logic of the function will be more clear because in any=20
case the function returns a substring using the name substr  and the=20
programmer see this.

=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 16:21:42 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> How is that *any* different from just using ctor (6) of basic_string? (
> http://en.cppreference.com/w/cpp/string/basic_string/basic_string)
>
> On Thu, May 24, 2018 at 3:19 PM 'Vlad from Moscow' via ISO C++ Standard -=
=20
> Future Proposals <std-pr...@isocpp.org <javascript:>> wrote:
>
>> At present the class template has only one member function *substr*=20
>> declared like
>>
>> basic_string substr(size_type pos =3D 0, size_type n =3D npos) const;
>>
>> As the class has iterators I would like to propose two overloads of the=
=20
>> function (or at least the first one):
>>
>> basic_string substr( const_iterator first, const_iterator last ) const;
>>
>>
>> and
>>
>> basic_string substr( const_reverse_iterator first,=20
>> const_reverse_iterator last ) const;
>>
>> The last function builds a substring in the reverse order.
>>
>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62=
f1-4eda-9435-388219d6f47c%40isocpp.org=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-6=
2f1-4eda-9435-388219d6f47c%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/cb9047c7-0859-450f-85ca-6de1edb40b25%40isocpp.or=
g.

------=_Part_6158_239457122.1527168535050
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It is more expressive. For example a function uses a strin=
g and depending on a condition either uses its own member functions and the=
 current member function substr or it uses standard algorithms and one of t=
he overloaded member functions substr with iterators.=C2=A0<div><br></div><=
div>In this case the logic of the function will be more clear because in an=
y case the function returns a substring using the name substr=C2=A0 and the=
 programmer see this.<br><br>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24=
 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 16:21:42 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=
=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak =D0=
=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-le=
ft: 1ex;"><div dir=3D"ltr">How is that <i>any</i>=C2=A0different from just =
using ctor (6) of basic_string? (<a href=3D"http://en.cppreference.com/w/cp=
p/string/basic_string/basic_string" target=3D"_blank" rel=3D"nofollow" onmo=
usedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fen.=
cppreference.com%2Fw%2Fcpp%2Fstring%2Fbasic_string%2Fbasic_string\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNEVljIowmP6J05jTQfukCCrTkw6bA&#39;;return tru=
e;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2=
Fen.cppreference.com%2Fw%2Fcpp%2Fstring%2Fbasic_string%2Fbasic_string\x26sa=
\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEVljIowmP6J05jTQfukCCrTkw6bA&#39;;return=
 true;">http://en.cppreference.com/w/<wbr>cpp/string/basic_string/basic_<wb=
r>string</a>)</div><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Thu, =
May 24, 2018 at 3:19 PM &#39;Vlad from Moscow&#39; via ISO C++ Standard - F=
uture Proposals &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscate=
d-mailto=3D"gE3jA3xQBQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;=
javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;=
;return true;">std-pr...@isocpp.org</a>&gt; wrote:<br></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div dir=3D"ltr">At present the class template has only one=
 member function <b>substr</b> declared like<div><br></div><div><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#000">basic_string substr</span><span style=3D"color:#660">(</spa=
n><span style=3D"color:#000">size_type pos </span><span style=3D"color:#660=
">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">0=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> size_=
type n </span><span style=3D"color:#660">=3D</span><span style=3D"color:#00=
0"> npos</span><span style=3D"color:#660">)</span><span style=3D"color:#000=
"> </span><span style=3D"color:#008">const</span><span style=3D"color:#660"=
>;</span></div></code></div><br>As the class has iterators I would like to =
propose two overloads of the function (or at least the first one):</div><di=
v><br></div><div><div style=3D"background-color:rgb(250,250,250);border-col=
or:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-wor=
d"><code><div><span style=3D"color:#000">basic_string substr</span><span st=
yle=3D"color:#660">(</span><span style=3D"color:#000"> const_iterator first=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> const=
_iterator </span><span style=3D"color:#008">last</span><span style=3D"color=
:#000"> </span><span style=3D"color:#660">)</span><span style=3D"color:#000=
"> </span><span style=3D"color:#008">const</span><span style=3D"color:#660"=
>;</span></div></code></div><br></div><div><br></div><div>and</div><div><br=
></div><div><div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode><div><span style=3D"color:#000">basic_string substr</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000"> const_reverse_iterator =
first</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
const_reverse_iterator </span><span style=3D"color:#008">last</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">)</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">const</span><span style=
=3D"color:#660">;</span></div></code></div><br></div><div>The last function=
 builds a substring in the reverse order.</div></div>

<p></p>

-- <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 <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
gE3jA3xQBQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"gE3jA3xQBQAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/0f2291ff-62f1-4eda-<wbr>9435-=
388219d6f47c%40isocpp.org</a><wbr>.<br>
</blockquote></div>
</blockquote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/cb9047c7-0859-450f-85ca-6de1edb40b25%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cb9047c7-0859-450f-85ca-6de1edb40b25=
%40isocpp.org</a>.<br />

------=_Part_6158_239457122.1527168535050--

------=_Part_6157_1338658938.1527168535049--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 24 May 2018 06:47:53 -0700 (PDT)
Raw View
------=_Part_6396_2004406604.1527169674024
Content-Type: multipart/alternative;
 boundary="----=_Part_6397_738196601.1527169674024"

------=_Part_6397_738196601.1527169674024
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

For example

    if ( condition )
    {
        // we can use algorithms of the class itself
        // calculating std::string::size_type pos
        // calculating std::string::size_type n
        std::cout << s.substr( pos, n ) << std::endl;
    }
    else
    {
        // we need to use standard algorithms
        // calculating std::string::const_iterator first
        // calculating std::string::const_iterator last
        std::cout << s.substr( first, last ) << std::endl;
    }




=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 16:28:55 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Vlad from Moscow=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> It is more expressive. For example a function uses a string and depending=
=20
> on a condition either uses its own member functions and the current membe=
r=20
> function substr or it uses standard algorithms and one of the overloaded=
=20
> member functions substr with iterators.=20
>
> In this case the logic of the function will be more clear because in any=
=20
> case the function returns a substring using the name substr  and the=20
> programmer see this.
>
> =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 16:21:42 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak=20
> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>> How is that *any* different from just using ctor (6) of basic_string? (
>> http://en.cppreference.com/w/cpp/string/basic_string/basic_string)
>>
>> On Thu, May 24, 2018 at 3:19 PM 'Vlad from Moscow' via ISO C++ Standard =
-=20
>> Future Proposals <std-pr...@isocpp.org> wrote:
>>
>>> At present the class template has only one member function *substr*=20
>>> declared like
>>>
>>> basic_string substr(size_type pos =3D 0, size_type n =3D npos) const;
>>>
>>> As the class has iterators I would like to propose two overloads of the=
=20
>>> function (or at least the first one):
>>>
>>> basic_string substr( const_iterator first, const_iterator last ) const;
>>>
>>>
>>> and
>>>
>>> basic_string substr( const_reverse_iterator first,=20
>>> const_reverse_iterator last ) const;
>>>
>>> The last function builds a substring in the reverse order.
>>>
>>> --=20
>>> You received this message because you are subscribed to the Google=20
>>> Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>> an email to std-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> To view this discussion on the web visit=20
>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-6=
2f1-4eda-9435-388219d6f47c%40isocpp.org=20
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-=
62f1-4eda-9435-388219d6f47c%40isocpp.org?utm_medium=3Demail&utm_source=3Dfo=
oter>
>>> .
>>>
>>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/ec8b141e-c7cb-403d-9639-42d879dae7da%40isocpp.or=
g.

------=_Part_6397_738196601.1527169674024
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">For example<div><br></div><div><div class=3D"prettyprint" =
style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, =
187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">if</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> condition </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #800;" c=
lass=3D"styled-by-prettify">// we can use algorithms of the class itself</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by=
-prettify">// calculating std::string::size_type pos</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <=
/span><span style=3D"color: #800;" class=3D"styled-by-prettify">// calculat=
ing std::string::size_type n</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">cout </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> s</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">substr</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> p=
os</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> n </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">endl</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">else</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// we need to use standard algorithms</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//=
 calculating std::string::const_iterator first</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">// calculating st=
d::string::const_iterator last</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">cout </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> s</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">substr</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> first</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">last</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;&lt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">endl</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
br></span></div></code></div><div><br><br></div><br>=D1=87=D0=B5=D1=82=D0=
=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 16:28:55 UTC+3 =
=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vl=
ad from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr">It is more expressive. For exa=
mple a function uses a string and depending on a condition either uses its =
own member functions and the current member function substr or it uses stan=
dard algorithms and one of the overloaded member functions substr with iter=
ators.=C2=A0<div><br></div><div>In this case the logic of the function will=
 be more clear because in any case the function returns a substring using t=
he name substr=C2=A0 and the programmer see this.<br><br>=D1=87=D0=B5=D1=82=
=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 16:21:42 UTC+=
3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C =
Micha=C5=82 Dominiak =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote=
 class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px =
#ccc solid;padding-left:1ex"><div dir=3D"ltr">How is that <i>any</i>=C2=A0d=
ifferent from just using ctor (6) of basic_string? (<a href=3D"http://en.cp=
preference.com/w/cpp/string/basic_string/basic_string" rel=3D"nofollow" tar=
get=3D"_blank" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\=
x3dhttp%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Fstring%2Fbasic_string%2Fbas=
ic_string\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEVljIowmP6J05jTQfukCCrTkw=
6bA&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.google.com/ur=
l?q\x3dhttp%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Fstring%2Fbasic_string%2=
Fbasic_string\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEVljIowmP6J05jTQfukCC=
rTkw6bA&#39;;return true;">http://en.cppreference.com/w/<wbr>cpp/string/bas=
ic_string/basic_<wbr>string</a>)</div><br><div class=3D"gmail_quote"><div d=
ir=3D"ltr">On Thu, May 24, 2018 at 3:19 PM &#39;Vlad from Moscow&#39; via I=
SO C++ Standard - Future Proposals &lt;<a rel=3D"nofollow">std-pr...@isocpp=
..org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
">At present the class template has only one member function <b>substr</b> =
declared like<div><br></div><div><div style=3D"background-color:rgb(250,250=
,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;wor=
d-wrap:break-word"><code><div><span style=3D"color:#000">basic_string subst=
r</span><span style=3D"color:#660">(</span><span style=3D"color:#000">size_=
type pos </span><span style=3D"color:#660">=3D</span><span style=3D"color:#=
000"> </span><span style=3D"color:#066">0</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> size_type n </span><span style=3D"color=
:#660">=3D</span><span style=3D"color:#000"> npos</span><span style=3D"colo=
r:#660">)</span><span style=3D"color:#000"> </span><span style=3D"color:#00=
8">const</span><span style=3D"color:#660">;</span></div></code></div><br>As=
 the class has iterators I would like to propose two overloads of the funct=
ion (or at least the first one):</div><div><br></div><div><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color=
:#000">basic_string substr</span><span style=3D"color:#660">(</span><span s=
tyle=3D"color:#000"> const_iterator first</span><span style=3D"color:#660">=
,</span><span style=3D"color:#000"> const_iterator </span><span style=3D"co=
lor:#008">last</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#660">)</span><span style=3D"color:#000"> </span><span style=3D"color:#00=
8">const</span><span style=3D"color:#660">;</span></div></code></div><br></=
div><div><br></div><div>and</div><div><br></div><div><div style=3D"backgrou=
nd-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;=
border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#000=
">basic_string substr</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000"> const_reverse_iterator first</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> const_reverse_iterator </span><span=
 style=3D"color:#008">last</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">)</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">const</span><span style=3D"color:#660">;</span></div></code=
></div><br></div><div>The last function builds a substring in the reverse o=
rder.</div></div>

<p></p>

-- <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 <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/0f2291ff-62f1-4eda-<wbr>9435-=
388219d6f47c%40isocpp.org</a><wbr>.<br>
</blockquote></div>
</blockquote></div></div></blockquote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ec8b141e-c7cb-403d-9639-42d879dae7da%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ec8b141e-c7cb-403d-9639-42d879dae7da=
%40isocpp.org</a>.<br />

------=_Part_6397_738196601.1527169674024--

------=_Part_6396_2004406604.1527169674024--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 24 May 2018 07:08:28 -0700 (PDT)
Raw View
------=_Part_6343_521515193.1527170908790
Content-Type: multipart/alternative;
 boundary="----=_Part_6344_809135799.1527170908791"

------=_Part_6344_809135799.1527170908791
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Also take into account that there is already constructor

basic_string(const basic_string& str, size_type pos, size_type n, const=20
Allocator& a =3D Allocator());


that can be a substitution for the member function substr. Nevertheless the=
=20
member function substr is used without the default arguments very ofthen=20
instead of the constructor.

So it would be logically consistent to introduce the overloads with=20
iterators.

=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 16:47:54 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Vlad from Moscow=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> For example
>
>     if ( condition )
>     {
>         // we can use algorithms of the class itself
>         // calculating std::string::size_type pos
>         // calculating std::string::size_type n
>         std::cout << s.substr( pos, n ) << std::endl;
>     }
>     else
>     {
>         // we need to use standard algorithms
>         // calculating std::string::const_iterator first
>         // calculating std::string::const_iterator last
>         std::cout << s.substr( first, last ) << std::endl;
>     }
>
>
>
>
> =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 16:28:55 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Vlad from Moscow=20
> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>> It is more expressive. For example a function uses a string and dependin=
g=20
>> on a condition either uses its own member functions and the current memb=
er=20
>> function substr or it uses standard algorithms and one of the overloaded=
=20
>> member functions substr with iterators.=20
>>
>> In this case the logic of the function will be more clear because in any=
=20
>> case the function returns a substring using the name substr  and the=20
>> programmer see this.
>>
>> =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 16:21:42 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak=20
>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>
>>> How is that *any* different from just using ctor (6) of basic_string? (
>>> http://en.cppreference.com/w/cpp/string/basic_string/basic_string)
>>>
>>> On Thu, May 24, 2018 at 3:19 PM 'Vlad from Moscow' via ISO C++ Standard=
=20
>>> - Future Proposals <std-pr...@isocpp.org> wrote:
>>>
>>>> At present the class template has only one member function *substr*=20
>>>> declared like
>>>>
>>>> basic_string substr(size_type pos =3D 0, size_type n =3D npos) const;
>>>>
>>>> As the class has iterators I would like to propose two overloads of th=
e=20
>>>> function (or at least the first one):
>>>>
>>>> basic_string substr( const_iterator first, const_iterator last ) const=
;
>>>>
>>>>
>>>> and
>>>>
>>>> basic_string substr( const_reverse_iterator first,=20
>>>> const_reverse_iterator last ) const;
>>>>
>>>> The last function builds a substring in the reverse order.
>>>>
>>>> --=20
>>>> You received this message because you are subscribed to the Google=20
>>>> Groups "ISO C++ Standard - Future Proposals" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>>> an email to std-proposal...@isocpp.org.
>>>> To post to this group, send email to std-pr...@isocpp.org.
>>>> To view this discussion on the web visit=20
>>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff-=
62f1-4eda-9435-388219d6f47c%40isocpp.org=20
>>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/0f2291ff=
-62f1-4eda-9435-388219d6f47c%40isocpp.org?utm_medium=3Demail&utm_source=3Df=
ooter>
>>>> .
>>>>
>>>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/38aee49f-8d37-451c-bef8-fd9d290c454d%40isocpp.or=
g.

------=_Part_6344_809135799.1527170908791
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Also take into account that there is already constructor<d=
iv><br></div><div><div class=3D"prettyprint" style=3D"background-color: rgb=
(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bor=
der-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div cl=
ass=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">basic_string</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">c=
onst</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> basic=
_string</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&am=
p;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> str</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> size_type pos</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> size_type n</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">const</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Allocator</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> a </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">Allocator</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">());</span></=
div></code></div><br><br>that can be a substitution for the member function=
 substr. Nevertheless the member function substr is used without the defaul=
t arguments very ofthen instead of the constructor.</div><div><br></div><di=
v>So it would be logically consistent to introduce the overloads with itera=
tors.</div><div><br>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=
=D0=B0=D1=8F 2018 =D0=B3., 16:47:54 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=
=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vlad from Moscow =D0=BD=D0=B0=D0=BF=
=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div =
dir=3D"ltr">For example<div><br></div><div><div style=3D"background-color:r=
gb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wid=
th:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">=C2=A0 =
=C2=A0 </span><span style=3D"color:#008">if</span><span style=3D"color:#000=
"> </span><span style=3D"color:#660">(</span><span style=3D"color:#000"> co=
ndition </span><span style=3D"color:#660">)</span><span style=3D"color:#000=
"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color=
:#800">// we can use algorithms of the class itself</span><span style=3D"co=
lor:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800"=
>// calculating std::string::size_type pos</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">// calcu=
lating std::string::size_type n</span><span style=3D"color:#000"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span s=
tyle=3D"color:#000">cout </span><span style=3D"color:#660">&lt;&lt;</span><=
span style=3D"color:#000"> s</span><span style=3D"color:#660">.</span><span=
 style=3D"color:#000">substr</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#000"> pos</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000"> n </span><span style=3D"color:#660">)</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#660">&lt;&lt;</span><span st=
yle=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span sty=
le=3D"color:#000">endl</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#=
008">else</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#800">// we need to use standard =
algorithms</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 </span><span style=3D"color:#800">// calculating std::string::const_iterat=
or first</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <=
/span><span style=3D"color:#800">// calculating std::string::const_iterator=
 last</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std<=
/span><span style=3D"color:#660">::</span><span style=3D"color:#000">cout <=
/span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">=
 s</span><span style=3D"color:#660">.</span><span style=3D"color:#000">subs=
tr</span><span style=3D"color:#660">(</span><span style=3D"color:#000"> fir=
st</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">last</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">)</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000"> std</spa=
n><span style=3D"color:#660">::</span><span style=3D"color:#000">endl</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#000"=
><br><br></span></div></code></div><div><br><br></div><br>=D1=87=D0=B5=D1=
=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 16:28:55 U=
TC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=
=8C Vlad from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote=
 class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px =
#ccc solid;padding-left:1ex"><div dir=3D"ltr">It is more expressive. For ex=
ample a function uses a string and depending on a condition either uses its=
 own member functions and the current member function substr or it uses sta=
ndard algorithms and one of the overloaded member functions substr with ite=
rators.=C2=A0<div><br></div><div>In this case the logic of the function wil=
l be more clear because in any case the function returns a substring using =
the name substr=C2=A0 and the programmer see this.<br><br>=D1=87=D0=B5=D1=
=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 16:21:42 U=
TC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=
=8C Micha=C5=82 Dominiak =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockq=
uote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">How is that <i>any</i>=C2=
=A0different from just using ctor (6) of basic_string? (<a href=3D"http://e=
n.cppreference.com/w/cpp/string/basic_string/basic_string" rel=3D"nofollow"=
 target=3D"_blank" onmousedown=3D"this.href=3D&#39;http://www.google.com/ur=
l?q\x3dhttp%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Fstring%2Fbasic_string%2=
Fbasic_string\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEVljIowmP6J05jTQfukCC=
rTkw6bA&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.google.co=
m/url?q\x3dhttp%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Fstring%2Fbasic_stri=
ng%2Fbasic_string\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEVljIowmP6J05jTQf=
ukCCrTkw6bA&#39;;return true;">http://en.cppreference.com/w/<wbr>cpp/string=
/basic_string/basic_<wbr>string</a>)</div><br><div class=3D"gmail_quote"><d=
iv dir=3D"ltr">On Thu, May 24, 2018 at 3:19 PM &#39;Vlad from Moscow&#39; v=
ia ISO C++ Standard - Future Proposals &lt;<a rel=3D"nofollow">std-pr...@is=
ocpp.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D=
"ltr">At present the class template has only one member function <b>substr<=
/b> declared like<div><br></div><div><div style=3D"background-color:rgb(250=
,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px=
;word-wrap:break-word"><code><div><span style=3D"color:#000">basic_string s=
ubstr</span><span style=3D"color:#660">(</span><span style=3D"color:#000">s=
ize_type pos </span><span style=3D"color:#660">=3D</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#066">0</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> size_type n </span><span style=3D"c=
olor:#660">=3D</span><span style=3D"color:#000"> npos</span><span style=3D"=
color:#660">)</span><span style=3D"color:#000"> </span><span style=3D"color=
:#008">const</span><span style=3D"color:#660">;</span></div></code></div><b=
r>As the class has iterators I would like to propose two overloads of the f=
unction (or at least the first one):</div><div><br></div><div><div style=3D=
"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-sty=
le:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"c=
olor:#000">basic_string substr</span><span style=3D"color:#660">(</span><sp=
an style=3D"color:#000"> const_iterator first</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> const_iterator </span><span style=
=3D"color:#008">last</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">const</span><span style=3D"color:#660">;</span></div></code></di=
v><br></div><div><br></div><div>and</div><div><br></div><div><div style=3D"=
background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-styl=
e:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"co=
lor:#000">basic_string substr</span><span style=3D"color:#660">(</span><spa=
n style=3D"color:#000"> const_reverse_iterator first</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> const_reverse_iterator </spa=
n><span style=3D"color:#008">last</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#660">)</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#008">const</span><span style=3D"color:#660">;</span></div>=
</code></div><br></div><div>The last function builds a substring in the rev=
erse order.</div></div>

<p></p>

-- <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 <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/0f2291ff-62f1-4eda-9435-388219d6f47c%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/0f2291ff-62f1-4eda-<wbr>9435-=
388219d6f47c%40isocpp.org</a><wbr>.<br>
</blockquote></div>
</blockquote></div></div></blockquote></div></div></blockquote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/38aee49f-8d37-451c-bef8-fd9d290c454d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/38aee49f-8d37-451c-bef8-fd9d290c454d=
%40isocpp.org</a>.<br />

------=_Part_6344_809135799.1527170908791--

------=_Part_6343_521515193.1527170908790--

.


Author: Bo Persson <bop@gmb.dk>
Date: Thu, 24 May 2018 16:57:08 +0200
Raw View
On 2018-05-24 16:08, 'Vlad from Moscow' via ISO C++ Standard - Future
Proposals wrote:
> Also take into account that there is already constructor
>
> |
> basic_string(constbasic_string&str,size_type pos,size_type
> n,constAllocator&a =Allocator());
> |
>
>
> that can be a substitution for the member function substr. Nevertheless
> the member function substr is used without the default arguments very
> ofthen instead of the constructor.
>
> So it would be logically consistent to introduce the overloads with
> iterators.
>

It is often considered that std::string has way more member functions
than what is healthy for a class. So adding even more functions needs a
better argument than consistency.

The class already has problems like this:

https://cplusplus.github.io/LWG/issue3076


     Bo Persson



--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/pe6jo1%248fa%241%40blaine.gmane.org.

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 24 May 2018 08:10:04 -0700 (PDT)
Raw View
------=_Part_6969_1433993545.1527174604881
Content-Type: multipart/alternative;
 boundary="----=_Part_6970_1620016653.1527174604881"

------=_Part_6970_1620016653.1527174604881
Content-Type: text/plain; charset="UTF-8"



On Thursday, May 24, 2018 at 9:47:54 AM UTC-4, Vlad from Moscow wrote:
>
> For example
>
>     if ( condition )
>     {
>         // we can use algorithms of the class itself
>         // calculating std::string::size_type pos
>         // calculating std::string::size_type n
>         std::cout << s.substr( pos, n ) << std::endl;
>     }
>     else
>     {
>         // we need to use standard algorithms
>         // calculating std::string::const_iterator first
>         // calculating std::string::const_iterator last
>         std::cout << s.substr( first, last ) << std::endl;
>     }
>
>
>
And yet, in neither of these cases do you really want to create a
`basic_string`; that's a waste of memory. What you *really* want is to
create a `string_view`. What you want is a hypothetical `s.view(pos, n)`
function.

Also, your code is generally unreasonable. What would this "condition" be
where you would switch between two different approaches to getting a
substring? Generally speaking, you pick one approach or the other at
compile time; runtime switching doesn't really make sense.

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ad1bf7d0-7144-4f7f-a5dc-0ea53dc03c01%40isocpp.org.

------=_Part_6970_1620016653.1527174604881
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Thursday, May 24, 2018 at 9:47:54 AM UTC-4, Vla=
d from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">For example<div><br></div><div><div style=3D"background-color:rgb(=
250,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:=
1px;word-wrap:break-word"><code><div><span style=3D"color:#000">=C2=A0 =C2=
=A0 </span><span style=3D"color:#008">if</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">(</span><span style=3D"color:#000"> condi=
tion </span><span style=3D"color:#660">)</span><span style=3D"color:#000"><=
br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">{</span><span style=3D"c=
olor:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800=
">// we can use algorithms of the class itself</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">// c=
alculating std::string::size_type pos</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">// calculatin=
g std::string::size_type n</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">cout </span><span style=3D"color:#660">&lt;&lt;</span><span=
 style=3D"color:#000"> s</span><span style=3D"color:#660">.</span><span sty=
le=3D"color:#000">substr</span><span style=3D"color:#660">(</span><span sty=
le=3D"color:#000"> pos</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> n </span><span style=3D"color:#660">)</span><span style=3D=
"color:#000"> </span><span style=3D"color:#660">&lt;&lt;</span><span style=
=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">endl</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#=
008">else</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 </span><span style=3D"color:#800">// we need to use standard =
algorithms</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 </span><span style=3D"color:#800">// calculating std::string::const_iterat=
or first</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <=
/span><span style=3D"color:#800">// calculating std::string::const_iterator=
 last</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 std<=
/span><span style=3D"color:#660">::</span><span style=3D"color:#000">cout <=
/span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000">=
 s</span><span style=3D"color:#660">.</span><span style=3D"color:#000">subs=
tr</span><span style=3D"color:#660">(</span><span style=3D"color:#000"> fir=
st</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">last</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">)</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000"> std</spa=
n><span style=3D"color:#660">::</span><span style=3D"color:#000">endl</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#000"=
><br><br></span></div></code></div><div><br></div></div></div></blockquote>=
<div><br></div><div>And yet, in neither of these cases do you really want t=
o create a `basic_string`; that&#39;s a waste of memory. What you <i>really=
</i> want is to create a `string_view`. What you want is a hypothetical `s.=
view(pos, n)` function.</div><div><br></div><div>Also, your code is general=
ly unreasonable. What would this &quot;condition&quot; be where you would s=
witch between two different approaches to getting a substring? Generally sp=
eaking, you pick one approach or the other at compile time; runtime switchi=
ng doesn&#39;t really make sense.</div><br></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ad1bf7d0-7144-4f7f-a5dc-0ea53dc03c01%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ad1bf7d0-7144-4f7f-a5dc-0ea53dc03c01=
%40isocpp.org</a>.<br />

------=_Part_6970_1620016653.1527174604881--

------=_Part_6969_1433993545.1527174604881--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 24 May 2018 08:25:08 -0700 (PDT)
Raw View
------=_Part_7170_736834182.1527175508535
Content-Type: multipart/alternative;
 boundary="----=_Part_7171_1997305216.1527175508535"

------=_Part_7171_1997305216.1527175508535
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

For example either you need to use the standard C function ::isspace and=20
standard find algorithms or you can use some kind of the find algorithm of=
=20
the class itself.

=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 18:10:04 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
>
>
> On Thursday, May 24, 2018 at 9:47:54 AM UTC-4, Vlad from Moscow wrote:
>>
>> For example
>>
>>     if ( condition )
>>     {
>>         // we can use algorithms of the class itself
>>         // calculating std::string::size_type pos
>>         // calculating std::string::size_type n
>>         std::cout << s.substr( pos, n ) << std::endl;
>>     }
>>     else
>>     {
>>         // we need to use standard algorithms
>>         // calculating std::string::const_iterator first
>>         // calculating std::string::const_iterator last
>>         std::cout << s.substr( first, last ) << std::endl;
>>     }
>>
>>
>>
> And yet, in neither of these cases do you really want to create a=20
> `basic_string`; that's a waste of memory. What you *really* want is to=20
> create a `string_view`. What you want is a hypothetical `s.view(pos, n)`=
=20
> function.
>
> Also, your code is generally unreasonable. What would this "condition" be=
=20
> where you would switch between two different approaches to getting a=20
> substring? Generally speaking, you pick one approach or the other at=20
> compile time; runtime switching doesn't really make sense.
>
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/a847d80e-f5d4-4f75-af69-93e6cf3f72e9%40isocpp.or=
g.

------=_Part_7171_1997305216.1527175508535
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">For example either you need to use the standard C function=
 ::isspace and standard find algorithms or you can use some kind of the fin=
d algorithm of the class itself.<br><br>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=
=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 18:10:04 UTC+3 =D0=BF=D0=BE=
=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;"><div dir=3D"ltr"><br><br>On Thursday, May 24, 2018 at 9:47:54 =
AM UTC-4, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D=
"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><d=
iv dir=3D"ltr">For example<div><br></div><div><div style=3D"background-colo=
r:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-=
width:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">=C2=
=A0 =C2=A0 </span><span style=3D"color:#008">if</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">(</span><span style=3D"color:#000"=
> condition </span><span style=3D"color:#660">)</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">{</span><span sty=
le=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"col=
or:#800">// we can use algorithms of the class itself</span><span style=3D"=
color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#80=
0">// calculating std::string::size_type pos</span><span style=3D"color:#00=
0"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">// cal=
culating std::string::size_type n</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><spa=
n style=3D"color:#000">cout </span><span style=3D"color:#660">&lt;&lt;</spa=
n><span style=3D"color:#000"> s</span><span style=3D"color:#660">.</span><s=
pan style=3D"color:#000">substr</span><span style=3D"color:#660">(</span><s=
pan style=3D"color:#000"> pos</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> n </span><span style=3D"color:#660">)</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">&lt;&lt;</span><span=
 style=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span =
style=3D"color:#000">endl</span><span style=3D"color:#660">;</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</s=
pan><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"colo=
r:#008">else</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 </span><span style=3D"color:#800">// we need to use standard=
 algorithms</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#800">// calculating std::string::const_ite=
rator first</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color:#800">// calculating std::string::const_ite=
rator last</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 std</span><span style=3D"color:#660">::</span><span style=3D"color:#000">c=
out </span><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#=
000"> s</span><span style=3D"color:#660">.</span><span style=3D"color:#000"=
>substr</span><span style=3D"color:#660">(</span><span style=3D"color:#000"=
> first</span><span style=3D"color:#660">,</span><span style=3D"color:#000"=
> </span><span style=3D"color:#008">last</span><span style=3D"color:#000"> =
</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">&lt;&lt;</span><span style=3D"color:#000"> std=
</span><span style=3D"color:#660">::</span><span style=3D"color:#000">endl<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#660">}</span><span style=3D"color:#=
000"><br><br></span></div></code></div><div><br></div></div></div></blockqu=
ote><div><br></div><div>And yet, in neither of these cases do you really wa=
nt to create a `basic_string`; that&#39;s a waste of memory. What you <i>re=
ally</i> want is to create a `string_view`. What you want is a hypothetical=
 `s.view(pos, n)` function.</div><div><br></div><div>Also, your code is gen=
erally unreasonable. What would this &quot;condition&quot; be where you wou=
ld switch between two different approaches to getting a substring? Generall=
y speaking, you pick one approach or the other at compile time; runtime swi=
tching doesn&#39;t really make sense.</div><br></div></blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/a847d80e-f5d4-4f75-af69-93e6cf3f72e9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a847d80e-f5d4-4f75-af69-93e6cf3f72e9=
%40isocpp.org</a>.<br />

------=_Part_7171_1997305216.1527175508535--

------=_Part_7170_736834182.1527175508535--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 24 May 2018 08:28:32 -0700 (PDT)
Raw View
------=_Part_7165_686144921.1527175712814
Content-Type: multipart/alternative;
 boundary="----=_Part_7166_1854048448.1527175712814"

------=_Part_7166_1854048448.1527175712814
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I do not think that adding the overloads of substr makes the class more=20
complex.

=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 17:57:23 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Bo Persson =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> On 2018-05-24 16:08, 'Vlad from Moscow' via ISO C++ Standard - Future=20
> Proposals wrote:=20
> > Also take into account that there is already constructor=20
> >=20
> > |=20
> > basic_string(constbasic_string&str,size_type pos,size_type=20
> > n,constAllocator&a =3DAllocator());=20
> > |=20
> >=20
> >=20
> > that can be a substitution for the member function substr. Nevertheless=
=20
> > the member function substr is used without the default arguments very=
=20
> > ofthen instead of the constructor.=20
> >=20
> > So it would be logically consistent to introduce the overloads with=20
> > iterators.=20
> >=20
>
> It is often considered that std::string has way more member functions=20
> than what is healthy for a class. So adding even more functions needs a=
=20
> better argument than consistency.=20
>
> The class already has problems like this:=20
>
> https://cplusplus.github.io/LWG/issue3076=20
>
>
>      Bo Persson=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/393d1734-10f4-4f8c-8dfd-c1598a709203%40isocpp.or=
g.

------=_Part_7166_1854048448.1527175712814
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I do not think that adding the overloads of substr makes t=
he class more complex.<br><br>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 2=
4 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 17:57:23 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=
=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Bo Persson =D0=BD=D0=B0=D0=
=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On=
 2018-05-24 16:08, &#39;Vlad from Moscow&#39; via ISO C++ Standard - Future=
=20
<br>Proposals wrote:
<br>&gt; Also take into account that there is already constructor
<br>&gt;=20
<br>&gt; |
<br>&gt; basic_string(constbasic_<wbr>string&amp;str,size_type pos,size_typ=
e=20
<br>&gt; n,constAllocator&amp;a =3DAllocator());
<br>&gt; |
<br>&gt;=20
<br>&gt;=20
<br>&gt; that can be a substitution for the member function substr. Neverth=
eless=20
<br>&gt; the member function substr is used without the default arguments v=
ery=20
<br>&gt; ofthen instead of the constructor.
<br>&gt;=20
<br>&gt; So it would be logically consistent to introduce the overloads wit=
h=20
<br>&gt; iterators.
<br>&gt;=20
<br>
<br>It is often considered that std::string has way more member functions=
=20
<br>than what is healthy for a class. So adding even more functions needs a=
=20
<br>better argument than consistency.
<br>
<br>The class already has problems like this:
<br>
<br><a href=3D"https://cplusplus.github.io/LWG/issue3076" target=3D"_blank"=
 rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://www.google.com/ur=
l?q\x3dhttps%3A%2F%2Fcplusplus.github.io%2FLWG%2Fissue3076\x26sa\x3dD\x26sn=
tz\x3d1\x26usg\x3dAFQjCNEci9LH_9AyANk3zl8U0jA60Dh-0w&#39;;return true;" onc=
lick=3D"this.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcplu=
splus.github.io%2FLWG%2Fissue3076\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE=
ci9LH_9AyANk3zl8U0jA60Dh-0w&#39;;return true;">https://cplusplus.github.io/=
<wbr>LWG/issue3076</a>
<br>
<br>
<br>=C2=A0 =C2=A0 =C2=A0Bo Persson
<br>
<br>
<br>
<br></blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/393d1734-10f4-4f8c-8dfd-c1598a709203%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/393d1734-10f4-4f8c-8dfd-c1598a709203=
%40isocpp.org</a>.<br />

------=_Part_7166_1854048448.1527175712814--

------=_Part_7165_686144921.1527175712814--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 24 May 2018 10:08:36 -0700 (PDT)
Raw View
------=_Part_7574_1922037584.1527181716234
Content-Type: multipart/alternative;
 boundary="----=_Part_7575_1408770306.1527181716234"

------=_Part_7575_1408770306.1527181716234
Content-Type: text/plain; charset="UTF-8"

On Thursday, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:
>
> For example either you need to use the standard C function ::isspace and
> standard find algorithms or you can use some kind of the find algorithm of
> the class itself.
>

Considering how easy it is to convert from pos/n format to iterator pairs
and vice-versa, why would you put the actual getting of the substring
inside of the condition? The condition's job is to get the range to
extract; it doesn't need to actually do the extraction. You pick the
convention you need to work with, and if some code needs to use the other
form, you convert for its sake, then convert back once that's done.

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8bbeddf0-11d8-438d-9855-e0176ca1e91d%40isocpp.org.

------=_Part_7575_1408770306.1527181716234
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from =
Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
For example either you need to use the standard C function ::isspace and st=
andard find algorithms or you can use some kind of the find algorithm of th=
e class itself.<br></div></blockquote><div><br></div><div>Considering how e=
asy it is to convert from pos/n format to iterator pairs and vice-versa, wh=
y would you put the actual getting of the substring inside of the condition=
? The condition&#39;s job is to get the range to extract; it doesn&#39;t ne=
ed to actually do the extraction. You pick the convention you need to work =
with, and if some code needs to use the other form, you convert for its sak=
e, then convert back once that&#39;s done.</div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8bbeddf0-11d8-438d-9855-e0176ca1e91d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8bbeddf0-11d8-438d-9855-e0176ca1e91d=
%40isocpp.org</a>.<br />

------=_Part_7575_1408770306.1527181716234--

------=_Part_7574_1922037584.1527181716234--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 24 May 2018 10:18:39 -0700 (PDT)
Raw View
------=_Part_7742_656222462.1527182319388
Content-Type: multipart/alternative;
 boundary="----=_Part_7743_2091413322.1527182319388"

------=_Part_7743_2091413322.1527182319388
Content-Type: text/plain; charset="UTF-8"

On Thursday, May 24, 2018 at 11:28:32 AM UTC-4, Vlad from Moscow wrote:
>
> I do not think that adding the overloads of substr makes the class more
> complex.
>

I'm sure every proposal that added some functions to `basic_string` said
the same thing. That kind of thinking is precisely how you get bloated
interfaces.

Those grains of seemingly irrelevant sand eventually add up to a desert.

That being said, I don't think `basic_string`'s interface is *unnecessarily*
bloated. I find that (most of) those functions are essential, but mainly
because there are no equivalent algorithms that can do those jobs anywhere
nearly as conveniently, clearly, and effectively.

`str.find("foo"sv)` is hundreds of times more digestible than `auto look =
"foo"sv; std::search(str.begin(), str.end(), look.begin(), look.end());`
Range TS gives us `std::search(str, "foo"sv)`, which is pretty reasonable.

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e59d5db0-e3f8-4a86-9f29-7a07a1f793bc%40isocpp.org.

------=_Part_7743_2091413322.1527182319388
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, May 24, 2018 at 11:28:32 AM UTC-4, Vlad from =
Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
I do not think that adding the overloads of substr makes the class more com=
plex.<br></div></blockquote><div><br></div><div>I&#39;m sure every proposal=
 that added some functions to `basic_string` said the same thing. That kind=
 of thinking is precisely how you get bloated interfaces.</div><div><br></d=
iv><div>Those grains of seemingly irrelevant sand eventually add up to a de=
sert.</div><div><br></div><div>That being said, I don&#39;t think `basic_st=
ring`&#39;s interface is <i>unnecessarily</i> bloated. I find that (most of=
) those functions are essential, but mainly because there are no equivalent=
 algorithms that can do those jobs anywhere nearly as conveniently, clearly=
, and effectively.</div><div><br></div><div>`str.find(&quot;foo&quot;sv)` i=
s hundreds of times more digestible than `auto look =3D &quot;foo&quot;sv; =
std::search(str.begin(), str.end(), look.begin(), look.end());` Range TS gi=
ves us `std::search(str, &quot;foo&quot;sv)`, which is pretty reasonable.<b=
r></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e59d5db0-e3f8-4a86-9f29-7a07a1f793bc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e59d5db0-e3f8-4a86-9f29-7a07a1f793bc=
%40isocpp.org</a>.<br />

------=_Part_7743_2091413322.1527182319388--

------=_Part_7742_656222462.1527182319388--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 25 May 2018 05:07:58 -0700 (PDT)
Raw View
------=_Part_13246_637340011.1527250078581
Content-Type: multipart/alternative;
 boundary="----=_Part_13247_474292531.1527250078581"

------=_Part_13247_474292531.1527250078581
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It is easy to convert but it is difficult to read.:)

For example if you have two iterators first and last (let's also assume=20
that the iterator last is a reverse iterator) then you have to write

s.substr( std::distance( std::begin( s ), first ), std::distance( first,=20
last.base() ) );

As you can see the record is too complicated. It would be more readable to=
=20
present the call like

s.substr( first, last.base() );





=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> On Thursday, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:
>>
>> For example either you need to use the standard C function ::isspace and=
=20
>> standard find algorithms or you can use some kind of the find algorithm =
of=20
>> the class itself.
>>
>
> Considering how easy it is to convert from pos/n format to iterator pairs=
=20
> and vice-versa, why would you put the actual getting of the substring=20
> inside of the condition? The condition's job is to get the range to=20
> extract; it doesn't need to actually do the extraction. You pick the=20
> convention you need to work with, and if some code needs to use the other=
=20
> form, you convert for its sake, then convert back once that's done.
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/7cae178f-0cde-4fe0-9741-c23e1cf33492%40isocpp.or=
g.

------=_Part_13247_474292531.1527250078581
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It is easy to convert but it is difficult to read.:)<div><=
br></div><div>For example if you have two iterators first and last (let&#39=
;s also assume that the iterator last is a reverse iterator) then you have =
to write</div><div><br></div><div><div class=3D"prettyprint" style=3D"backg=
round-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-s=
tyle: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pret=
typrint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">s</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">substr</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">distance</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> std</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">begin</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> s </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">),</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 first </span><span style=3D"color: #660;" class=3D"styled-by-prettify">),<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">distance</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> first</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">last</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">.</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">base</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">);</span></div></code></div><br></div=
><div>As you can see the record is too complicated. It would be more readab=
le to present the call like</div><div><br></div><div class=3D"prettyprint" =
style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, =
187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#000;" class=3D"styled-by-prettify">s</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">substr</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> first</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">last</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">base</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br><br></span></div></code></div><div><br><br></div><div><br><=
br>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex=
;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Thursd=
ay, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr">For example either you need to =
use the standard C function ::isspace and standard find algorithms or you c=
an use some kind of the find algorithm of the class itself.<br></div></bloc=
kquote><div><br></div><div>Considering how easy it is to convert from pos/n=
 format to iterator pairs and vice-versa, why would you put the actual gett=
ing of the substring inside of the condition? The condition&#39;s job is to=
 get the range to extract; it doesn&#39;t need to actually do the extractio=
n. You pick the convention you need to work with, and if some code needs to=
 use the other form, you convert for its sake, then convert back once that&=
#39;s done.</div></div></blockquote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/7cae178f-0cde-4fe0-9741-c23e1cf33492%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7cae178f-0cde-4fe0-9741-c23e1cf33492=
%40isocpp.org</a>.<br />

------=_Part_13247_474292531.1527250078581--

------=_Part_13246_637340011.1527250078581--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 25 May 2018 05:15:50 -0700 (PDT)
Raw View
------=_Part_2004_828995910.1527250550137
Content-Type: multipart/alternative;
 boundary="----=_Part_2005_1161068069.1527250550137"

------=_Part_2005_1161068069.1527250550137
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Take also into account that for the last shown record you can substitute=20
the iterator first for a call of a standard algorithm and the record will=
=20
be still readable. For example

s.substr( std::find_if_not( std::begin( s ), std::end( s ), ::isspace ),=20
last.base() );



=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 15:07:58 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Vlad from Moscow=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> It is easy to convert but it is difficult to read.:)
>
> For example if you have two iterators first and last (let's also assume=
=20
> that the iterator last is a reverse iterator) then you have to write
>
> s.substr( std::distance( std::begin( s ), first ), std::distance( first,=
=20
> last.base() ) );
>
> As you can see the record is too complicated. It would be more readable t=
o=20
> present the call like
>
> s.substr( first, last.base() );
>
>
>
>
>
> =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
>>
>> On Thursday, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:
>>>
>>> For example either you need to use the standard C function ::isspace an=
d=20
>>> standard find algorithms or you can use some kind of the find algorithm=
 of=20
>>> the class itself.
>>>
>>
>> Considering how easy it is to convert from pos/n format to iterator pair=
s=20
>> and vice-versa, why would you put the actual getting of the substring=20
>> inside of the condition? The condition's job is to get the range to=20
>> extract; it doesn't need to actually do the extraction. You pick the=20
>> convention you need to work with, and if some code needs to use the othe=
r=20
>> form, you convert for its sake, then convert back once that's done.
>>
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/75099ba4-550d-4a70-af21-218512c370a1%40isocpp.or=
g.

------=_Part_2005_1161068069.1527250550137
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Take also into account that for the last shown record you =
can substitute the iterator first for a call of a standard algorithm and th=
e record will be still readable. For example<div><br></div><div><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">s</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">substr</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">find_if_not</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">begin</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> s </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">),</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">:</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">:</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">end</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> s </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">),</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">isspace </span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">),</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">last</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">.</span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">base</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">);</span></div></c=
ode></div><br><br><br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=
=D0=B0=D1=8F 2018 =D0=B3., 15:07:58 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=
=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Vlad from Moscow =D0=BD=D0=B0=D0=BF=
=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div =
dir=3D"ltr">It is easy to convert but it is difficult to read.:)<div><br></=
div><div>For example if you have two iterators first and last (let&#39;s al=
so assume that the iterator last is a reverse iterator) then you have to wr=
ite</div><div><br></div><div><div style=3D"background-color:rgb(250,250,250=
);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wr=
ap:break-word"><code><div><span style=3D"color:#000">s</span><span style=3D=
"color:#660">.</span><span style=3D"color:#000">substr</span><span style=3D=
"color:#660">(</span><span style=3D"color:#000"> std</span><span style=3D"c=
olor:#660">::</span><span style=3D"color:#000">distance</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000"> std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#008">begin</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000"> s </span><span style=3D=
"color:#660">),</span><span style=3D"color:#000"> first </span><span style=
=3D"color:#660">),</span><span style=3D"color:#000"> std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">distance</span><span st=
yle=3D"color:#660">(</span><span style=3D"color:#000"> first</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">last</span><span style=3D"color:#660">.</span><span style=
=3D"color:#008">base</span><span style=3D"color:#660">()</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">)</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">);</span></div></code></div><=
br></div><div>As you can see the record is too complicated. It would be mor=
e readable to present the call like</div><div><br></div><div style=3D"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#=
000">s</span><span style=3D"color:#660">.</span><span style=3D"color:#000">=
substr</span><span style=3D"color:#660">(</span><span style=3D"color:#000">=
 first</span><span style=3D"color:#660">,</span><span style=3D"color:#000">=
 </span><span style=3D"color:#008">last</span><span style=3D"color:#660">.<=
/span><span style=3D"color:#008">base</span><span style=3D"color:#660">()</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">);</span=
><span style=3D"color:#000"><br><br></span></div></code></div><div><br><br>=
</div><div><br><br>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=
=B0=D1=8F 2018 =D0=B3., 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=
=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=
=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" style=3D"margin:0;marg=
in-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"=
>On Thursday, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">For example either yo=
u need to use the standard C function ::isspace and standard find algorithm=
s or you can use some kind of the find algorithm of the class itself.<br></=
div></blockquote><div><br></div><div>Considering how easy it is to convert =
from pos/n format to iterator pairs and vice-versa, why would you put the a=
ctual getting of the substring inside of the condition? The condition&#39;s=
 job is to get the range to extract; it doesn&#39;t need to actually do the=
 extraction. You pick the convention you need to work with, and if some cod=
e needs to use the other form, you convert for its sake, then convert back =
once that&#39;s done.</div></div></blockquote></div></div></blockquote></di=
v></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/75099ba4-550d-4a70-af21-218512c370a1%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/75099ba4-550d-4a70-af21-218512c370a1=
%40isocpp.org</a>.<br />

------=_Part_2005_1161068069.1527250550137--

------=_Part_2004_828995910.1527250550137--

.


Author: =?UTF-8?B?R2HFoXBlciBBxb5tYW4=?= <gasper.azman@gmail.com>
Date: Fri, 25 May 2018 13:19:02 +0100
Raw View
--0000000000003717ae056d06c771
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Honestly that's a problem I've had for a long time. Also, it's not a
template method (depends on string's const_iterator).

While it's true string is overly complex... I do think providing these at
this point is a good idea.
G

On Fri, May 25, 2018 at 1:15 PM, 'Vlad from Moscow' via ISO C++ Standard -
Future Proposals <std-proposals@isocpp.org> wrote:

> Take also into account that for the last shown record you can substitute
> the iterator first for a call of a standard algorithm and the record will
> be still readable. For example
>
> s.substr( std::find_if_not( std::begin( s ), std::end( s ), ::isspace ),
> last.base() );
>
>
>
> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 15:07:58 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Vlad from Moscow
> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>> It is easy to convert but it is difficult to read.:)
>>
>> For example if you have two iterators first and last (let's also assume
>> that the iterator last is a reverse iterator) then you have to write
>>
>> s.substr( std::distance( std::begin( s ), first ), std::distance( first,
>> last.base() ) );
>>
>> As you can see the record is too complicated. It would be more readable
>> to present the call like
>>
>> s.substr( first, last.base() );
>>
>>
>>
>>
>>
>> =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
>>>
>>> On Thursday, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:
>>>>
>>>> For example either you need to use the standard C function ::isspace
>>>> and standard find algorithms or you can use some kind of the find algo=
rithm
>>>> of the class itself.
>>>>
>>>
>>> Considering how easy it is to convert from pos/n format to iterator
>>> pairs and vice-versa, why would you put the actual getting of the subst=
ring
>>> inside of the condition? The condition's job is to get the range to
>>> extract; it doesn't need to actually do the extraction. You pick the
>>> convention you need to work with, and if some code needs to use the oth=
er
>>> form, you convert for its sake, then convert back once that's done.
>>>
>> --
> 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.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/75099ba4-550d-4a70-
> af21-218512c370a1%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/75099ba4-55=
0d-4a70-af21-218512c370a1%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAANG%3DkWWoB%3DGuj%3DhQWue_tm8dx0EY_hSoT-YkbB%2=
BNsgL0VaLoA%40mail.gmail.com.

--0000000000003717ae056d06c771
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Honestly that&#39;s a problem I&#39;ve had for a long time=
.. Also, it&#39;s not a template method (depends on string&#39;s const_itera=
tor).<div><br></div><div>While it&#39;s true string is overly complex... I =
do think providing these at this point is a good idea.</div><div>G</div></d=
iv><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Fri, May 25=
, 2018 at 1:15 PM, &#39;Vlad from Moscow&#39; via ISO C++ Standard - Future=
 Proposals <span dir=3D"ltr">&lt;<a href=3D"mailto:std-proposals@isocpp.org=
" target=3D"_blank">std-proposals@isocpp.org</a>&gt;</span> wrote:<br><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr">Take also into account that for =
the last shown record you can substitute the iterator first for a call of a=
 standard algorithm and the record will be still readable. For example<div>=
<br></div><div><div class=3D"gmail-m_2822605353764347059prettyprint" style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code class=3D"gmail-m_2=
822605353764347059prettyprint"><div class=3D"gmail-m_2822605353764347059sub=
prettyprint"><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_282260535376=
4347059styled-by-prettify">s</span><span style=3D"color:rgb(102,102,0)" cla=
ss=3D"gmail-m_2822605353764347059styled-by-prettify">.</span><span style=3D=
"color:rgb(0,0,0)" class=3D"gmail-m_2822605353764347059styled-by-prettify">=
substr</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_28226053=
53764347059styled-by-prettify">(</span><span style=3D"color:rgb(0,0,0)" cla=
ss=3D"gmail-m_2822605353764347059styled-by-prettify"> std</span><span style=
=3D"color:rgb(102,102,0)" class=3D"gmail-m_2822605353764347059styled-by-pre=
ttify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_282260535=
3764347059styled-by-prettify">find_if_not</span><span style=3D"color:rgb(10=
2,102,0)" class=3D"gmail-m_2822605353764347059styled-by-prettify">(</span><=
span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2822605353764347059styled-=
by-prettify"> std</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail=
-m_2822605353764347059styled-by-prettify">::</span><span style=3D"color:rgb=
(0,0,136)" class=3D"gmail-m_2822605353764347059styled-by-prettify">begin</s=
pan><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_28226053537643470=
59styled-by-prettify">(</span><span style=3D"color:rgb(0,0,0)" class=3D"gma=
il-m_2822605353764347059styled-by-prettify"> s </span><span style=3D"color:=
rgb(102,102,0)" class=3D"gmail-m_2822605353764347059styled-by-prettify">),<=
/span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2822605353764347059=
styled-by-prettify"> std</span><span style=3D"color:rgb(102,102,0)" class=
=3D"gmail-m_2822605353764347059styled-by-prettify">:</span><span style=3D"c=
olor:rgb(102,102,0)" class=3D"gmail-m_2822605353764347059styled-by-prettify=
">:</span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_2822605353764=
347059styled-by-prettify">end</span><span style=3D"color:rgb(102,102,0)" cl=
ass=3D"gmail-m_2822605353764347059styled-by-prettify">(</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_2822605353764347059styled-by-prettif=
y"> s </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_28226053=
53764347059styled-by-prettify">),</span><span style=3D"color:rgb(0,0,0)" cl=
ass=3D"gmail-m_2822605353764347059styled-by-prettify"> </span><span style=
=3D"color:rgb(102,102,0)" class=3D"gmail-m_2822605353764347059styled-by-pre=
ttify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_282260535=
3764347059styled-by-prettify">isspace </span><span style=3D"color:rgb(102,1=
02,0)" class=3D"gmail-m_2822605353764347059styled-by-prettify">),</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2822605353764347059styled-by=
-prettify"> </span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_2822=
605353764347059styled-by-prettify">last</span><span style=3D"color:rgb(102,=
102,0)" class=3D"gmail-m_2822605353764347059styled-by-prettify">.</span><sp=
an style=3D"color:rgb(0,0,136)" class=3D"gmail-m_2822605353764347059styled-=
by-prettify">base</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail=
-m_2822605353764347059styled-by-prettify">()</span><span style=3D"color:rgb=
(0,0,0)" class=3D"gmail-m_2822605353764347059styled-by-prettify"> </span><s=
pan style=3D"color:rgb(102,102,0)" class=3D"gmail-m_2822605353764347059styl=
ed-by-prettify">);</span></div></code></div><br><br><br>=D0=BF=D1=8F=D1=82=
=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 15:07:58 UTC+=
3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C =
Vlad from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<span class=3D"=
gmail-"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex=
;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">=
It is easy to convert but it is difficult to read.:)<div><br></div><div>For=
 example if you have two iterators first and last (let&#39;s also assume th=
at the iterator last is a reverse iterator) then you have to write</div><di=
v><br></div><div><div style=3D"background-color:rgb(250,250,250);border-col=
or:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-wor=
d"><code><div><span style=3D"color:rgb(0,0,0)">s</span><span style=3D"color=
:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">substr</span><spa=
n style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> =
std</span><span style=3D"color:rgb(102,102,0)">::</span><span style=3D"colo=
r:rgb(0,0,0)">distance</span><span style=3D"color:rgb(102,102,0)">(</span><=
span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102=
,0)">::</span><span style=3D"color:rgb(0,0,136)">begin</span><span style=3D=
"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> s </span><=
span style=3D"color:rgb(102,102,0)">),</span><span style=3D"color:rgb(0,0,0=
)"> first </span><span style=3D"color:rgb(102,102,0)">),</span><span style=
=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102,0)">::</s=
pan><span style=3D"color:rgb(0,0,0)">distance</span><span style=3D"color:rg=
b(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> first</span><span s=
tyle=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </s=
pan><span style=3D"color:rgb(0,0,136)">last</span><span style=3D"color:rgb(=
102,102,0)">.</span><span style=3D"color:rgb(0,0,136)">base</span><span sty=
le=3D"color:rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> </sp=
an><span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rgb(0,=
0,0)"> </span><span style=3D"color:rgb(102,102,0)">);</span></div></code></=
div><br></div><div>As you can see the record is too complicated. It would b=
e more readable to present the call like</div><div><br></div><div style=3D"=
background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-styl=
e:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"co=
lor:rgb(0,0,0)">s</span><span style=3D"color:rgb(102,102,0)">.</span><span =
style=3D"color:rgb(0,0,0)">substr</span><span style=3D"color:rgb(102,102,0)=
">(</span><span style=3D"color:rgb(0,0,0)"> first</span><span style=3D"colo=
r:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span><span st=
yle=3D"color:rgb(0,0,136)">last</span><span style=3D"color:rgb(102,102,0)">=
..</span><span style=3D"color:rgb(0,0,136)">base</span><span style=3D"color:=
rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> </span><span sty=
le=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0,0)"><br><=
br></span></div></code></div><div><br><br></div><div><br><br>=D1=87=D0=B5=
=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 20:08:3=
6 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=
=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">On Thursday, May 24, =
2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:<blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex"><div dir=3D"ltr">For example either you need to us=
e the standard C function ::isspace and standard find algorithms or you can=
 use some kind of the find algorithm of the class itself.<br></div></blockq=
uote><div><br></div><div>Considering how easy it is to convert from pos/n f=
ormat to iterator pairs and vice-versa, why would you put the actual gettin=
g of the substring inside of the condition? The condition&#39;s job is to g=
et the range to extract; it doesn&#39;t need to actually do the extraction.=
 You pick the convention you need to work with, and if some code needs to u=
se the other form, you convert for its sake, then convert back once that&#3=
9;s done.</div></div></blockquote></div></div></blockquote></span></div></d=
iv><span class=3D"gmail-">

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/75099ba4-550d-4a70-af21-218512c370a1%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/7509=
9ba4-550d-4a70-<wbr>af21-218512c370a1%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkWWoB%3DGuj%3DhQWue_tm8dx0EY_=
hSoT-YkbB%2BNsgL0VaLoA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoo=
ter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3Dk=
WWoB%3DGuj%3DhQWue_tm8dx0EY_hSoT-YkbB%2BNsgL0VaLoA%40mail.gmail.com</a>.<br=
 />

--0000000000003717ae056d06c771--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 25 May 2018 05:22:57 -0700 (PDT)
Raw View
------=_Part_13052_377662272.1527250977103
Content-Type: multipart/alternative;
 boundary="----=_Part_13053_13302220.1527250977103"

------=_Part_13053_13302220.1527250977103
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

In fact most of the member functions that create a new representation of=20
the object of the class template std::basic_string have an overload that=20
uses iterators as for example assign, append, insert, replace, erase. And=
=20
only the member function substr does not use iterators..

=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 20:18:39 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> On Thursday, May 24, 2018 at 11:28:32 AM UTC-4, Vlad from Moscow wrote:
>>
>> I do not think that adding the overloads of substr makes the class more=
=20
>> complex.
>>
>
> I'm sure every proposal that added some functions to `basic_string` said=
=20
> the same thing. That kind of thinking is precisely how you get bloated=20
> interfaces.
>
> Those grains of seemingly irrelevant sand eventually add up to a desert.
>
> That being said, I don't think `basic_string`'s interface is=20
> *unnecessarily* bloated. I find that (most of) those functions are=20
> essential, but mainly because there are no equivalent algorithms that can=
=20
> do those jobs anywhere nearly as conveniently, clearly, and effectively.
>
> `str.find("foo"sv)` is hundreds of times more digestible than `auto look =
=3D=20
> "foo"sv; std::search(str.begin(), str.end(), look.begin(), look.end());`=
=20
> Range TS gives us `std::search(str, "foo"sv)`, which is pretty reasonable=
..
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/9c62c391-1593-437d-b839-ce62472cf0ea%40isocpp.or=
g.

------=_Part_13053_13302220.1527250977103
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">In fact most of the member functions that create a new rep=
resentation of the object of the class template std::basic_string have an o=
verload that uses iterators as for example assign, append, insert, replace,=
 erase. And only the member function substr does not use iterators..<br><br=
>=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 20:18:39 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<=
blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bord=
er-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Thursday, M=
ay 24, 2018 at 11:28:32 AM UTC-4, Vlad from Moscow wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><div dir=3D"ltr">I do not think that adding the over=
loads of substr makes the class more complex.<br></div></blockquote><div><b=
r></div><div>I&#39;m sure every proposal that added some functions to `basi=
c_string` said the same thing. That kind of thinking is precisely how you g=
et bloated interfaces.</div><div><br></div><div>Those grains of seemingly i=
rrelevant sand eventually add up to a desert.</div><div><br></div><div>That=
 being said, I don&#39;t think `basic_string`&#39;s interface is <i>unneces=
sarily</i> bloated. I find that (most of) those functions are essential, bu=
t mainly because there are no equivalent algorithms that can do those jobs =
anywhere nearly as conveniently, clearly, and effectively.</div><div><br></=
div><div>`str.find(&quot;foo&quot;sv)` is hundreds of times more digestible=
 than `auto look =3D &quot;foo&quot;sv; std::search(str.begin(), str.end(),=
 look.begin(), look.end());` Range TS gives us `std::search(str, &quot;foo&=
quot;sv)`, which is pretty reasonable.<br></div></div></blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/9c62c391-1593-437d-b839-ce62472cf0ea%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9c62c391-1593-437d-b839-ce62472cf0ea=
%40isocpp.org</a>.<br />

------=_Part_13053_13302220.1527250977103--

------=_Part_13052_377662272.1527250977103--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 25 May 2018 05:47:24 -0700 (PDT)
Raw View
------=_Part_13232_821710418.1527252444442
Content-Type: multipart/alternative;
 boundary="----=_Part_13233_56722883.1527252444442"

------=_Part_13233_56722883.1527252444442
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

You can consider the overload=20

basic_string substr( const_iterator first, const_iterator last ) const;

as a counterpart of the overload

iterator erase(const_iterator first, const_iterator last);


=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 15:19:25 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Ga=C5=A1per A=C5=BEman =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=
=B0=D0=BB:
>
> Honestly that's a problem I've had for a long time. Also, it's not a=20
> template method (depends on string's const_iterator).
>
> While it's true string is overly complex... I do think providing these at=
=20
> this point is a good idea.
> G
>
> On Fri, May 25, 2018 at 1:15 PM, 'Vlad from Moscow' via ISO C++ Standard =
-=20
> Future Proposals <std-pr...@isocpp.org <javascript:>> wrote:
>
>> Take also into account that for the last shown record you can substitute=
=20
>> the iterator first for a call of a standard algorithm and the record wil=
l=20
>> be still readable. For example
>>
>> s.substr( std::find_if_not( std::begin( s ), std::end( s ), ::isspace ),=
=20
>> last.base() );
>>
>>
>>
>> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 15:07:58 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Vlad from Moscow=20
>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>
>>> It is easy to convert but it is difficult to read.:)
>>>
>>> For example if you have two iterators first and last (let's also assume=
=20
>>> that the iterator last is a reverse iterator) then you have to write
>>>
>>> s.substr( std::distance( std::begin( s ), first ), std::distance( first=
,=20
>>> last.base() ) );
>>>
>>> As you can see the record is too complicated. It would be more readable=
=20
>>> to present the call like
>>>
>>> s.substr( first, last.base() );
>>>
>>>
>>>
>>>
>>>
>>> =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
>>>>
>>>> On Thursday, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote=
:
>>>>>
>>>>> For example either you need to use the standard C function ::isspace=
=20
>>>>> and standard find algorithms or you can use some kind of the find alg=
orithm=20
>>>>> of the class itself.
>>>>>
>>>>
>>>> Considering how easy it is to convert from pos/n format to iterator=20
>>>> pairs and vice-versa, why would you put the actual getting of the subs=
tring=20
>>>> inside of the condition? The condition's job is to get the range to=20
>>>> extract; it doesn't need to actually do the extraction. You pick the=
=20
>>>> convention you need to work with, and if some code needs to use the ot=
her=20
>>>> form, you convert for its sake, then convert back once that's done.
>>>>
>>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/75099ba4-55=
0d-4a70-af21-218512c370a1%40isocpp.org=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/75099ba4-5=
50d-4a70-af21-218512c370a1%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
>
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/27926686-b222-4194-b606-c52d4a424e9e%40isocpp.or=
g.

------=_Part_13233_56722883.1527252444442
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">You can consider the overload=C2=A0<br><br><div class=3D"p=
rettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rg=
b(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-=
word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span styl=
e=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" class=3D"styled-by-=
prettify">basic_string substr</span></span><span style=3D"color: rgb(102, 1=
02, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span>=
</span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> const_iterator first</span></span><span style=
=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span></span><span style=3D"color: rgb(0, 0, 0);"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> const_iterator </span></sp=
an><span style=3D"color: rgb(0, 0, 136);"><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">last</span></span><span style=3D"color: rgb(0, 0, =
0);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></sp=
an><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">)</span></span><span style=3D"color: rgb(0, 0, 0=
);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></spa=
n><span style=3D"color: rgb(0, 0, 136);"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">const</span></span><span style=3D"color: rgb(102, 1=
02, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span>=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span=
></div></code></div><span style=3D"font-family: monospace; background-color=
: rgb(250, 250, 250); color: rgb(102, 102, 0);"><br></span>as a counterpart=
 of the overload<div><br></div><div><div class=3D"prettyprint" style=3D"bac=
kground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border=
-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">iterator erase</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">const_iterator first</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> const_iterator </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">last</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">);</span></div></code></div><br><br>=D0=BF=D1=8F=D1=82=
=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 15:19:25 UTC+=
3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C =
Ga=C5=A1per A=C5=BEman =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquo=
te class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left:=
 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Honestly that&#39;s a =
problem I&#39;ve had for a long time. Also, it&#39;s not a template method =
(depends on string&#39;s const_iterator).<div><br></div><div>While it&#39;s=
 true string is overly complex... I do think providing these at this point =
is a good idea.</div><div>G</div></div><div><br><div class=3D"gmail_quote">=
On Fri, May 25, 2018 at 1:15 PM, &#39;Vlad from Moscow&#39; via ISO C++ Sta=
ndard - Future Proposals <span dir=3D"ltr">&lt;<a href=3D"javascript:" targ=
et=3D"_blank" gdf-obfuscated-mailto=3D"YOHrbaqbBQAJ" rel=3D"nofollow" onmou=
sedown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.h=
ref=3D&#39;javascript:&#39;;return true;">std-pr...@isocpp.org</a>&gt;</spa=
n> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Take also into=
 account that for the last shown record you can substitute the iterator fir=
st for a call of a standard algorithm and the record will be still readable=
.. For example<div><br></div><div><div style=3D"background-color:rgb(250,250=
,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;wor=
d-wrap:break-word"><code><div><span style=3D"color:rgb(0,0,0)">s</span><spa=
n style=3D"color:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">s=
ubstr</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"col=
or:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102,0)">::</span><sp=
an style=3D"color:rgb(0,0,0)">find_if_not</span><span style=3D"color:rgb(10=
2,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> std</span><span style=
=3D"color:rgb(102,102,0)">::</span><span style=3D"color:rgb(0,0,136)">begin=
</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rg=
b(0,0,0)"> s </span><span style=3D"color:rgb(102,102,0)">),</span><span sty=
le=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102,0)">:</=
span><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(=
0,0,136)">end</span><span style=3D"color:rgb(102,102,0)">(</span><span styl=
e=3D"color:rgb(0,0,0)"> s </span><span style=3D"color:rgb(102,102,0)">),</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,1=
02,0)">::</span><span style=3D"color:rgb(0,0,0)">isspace </span><span style=
=3D"color:rgb(102,102,0)">),</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(0,0,136)">last</span><span style=3D"color:rgb(102=
,102,0)">.</span><span style=3D"color:rgb(0,0,136)">base</span><span style=
=3D"color:rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(102,102,0)">);</span></div></code></div><br><br><=
br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 15:07:58 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Vlad from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=
=D0=BB:<span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"=
ltr">It is easy to convert but it is difficult to read.:)<div><br></div><di=
v>For example if you have two iterators first and last (let&#39;s also assu=
me that the iterator last is a reverse iterator) then you have to write</di=
v><div><br></div><div><div style=3D"background-color:rgb(250,250,250);borde=
r-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:brea=
k-word"><code><div><span style=3D"color:rgb(0,0,0)">s</span><span style=3D"=
color:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">substr</span=
><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,=
0)"> std</span><span style=3D"color:rgb(102,102,0)">::</span><span style=3D=
"color:rgb(0,0,0)">distance</span><span style=3D"color:rgb(102,102,0)">(</s=
pan><span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(10=
2,102,0)">::</span><span style=3D"color:rgb(0,0,136)">begin</span><span sty=
le=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> s </s=
pan><span style=3D"color:rgb(102,102,0)">),</span><span style=3D"color:rgb(=
0,0,0)"> first </span><span style=3D"color:rgb(102,102,0)">),</span><span s=
tyle=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102,0)">:=
:</span><span style=3D"color:rgb(0,0,0)">distance</span><span style=3D"colo=
r:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> first</span><sp=
an style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)">=
 </span><span style=3D"color:rgb(0,0,136)">last</span><span style=3D"color:=
rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,136)">base</span><span=
 style=3D"color:rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> =
</span><span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">);</span></div></cod=
e></div><br></div><div>As you can see the record is too complicated. It wou=
ld be more readable to present the call like</div><div><br></div><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:rgb(0,0,0)">s</span><span style=3D"color:rgb(102,102,0)">.</span>=
<span style=3D"color:rgb(0,0,0)">substr</span><span style=3D"color:rgb(102,=
102,0)">(</span><span style=3D"color:rgb(0,0,0)"> first</span><span style=
=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(0,0,136)">last</span><span style=3D"color:rgb(102,=
102,0)">.</span><span style=3D"color:rgb(0,0,136)">base</span><span style=
=3D"color:rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0=
,0)"><br><br></span></div></code></div><div><br><br></div><div><br><br>=D1=
=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=B3.=
, 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=
=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">On Thursday,=
 May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid r=
gb(204,204,204);padding-left:1ex"><div dir=3D"ltr">For example either you n=
eed to use the standard C function ::isspace and standard find algorithms o=
r you can use some kind of the find algorithm of the class itself.<br></div=
></blockquote><div><br></div><div>Considering how easy it is to convert fro=
m pos/n format to iterator pairs and vice-versa, why would you put the actu=
al getting of the substring inside of the condition? The condition&#39;s jo=
b is to get the range to extract; it doesn&#39;t need to actually do the ex=
traction. You pick the convention you need to work with, and if some code n=
eeds to use the other form, you convert for its sake, then convert back onc=
e that&#39;s done.</div></div></blockquote></div></div></blockquote></span>=
</div></div><span>

<p></p>

-- <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 <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
YOHrbaqbBQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"YOHrbaqbBQAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/75099ba4-550d-4a70-af21-218512c370a1%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/75099ba4-550d-4a70-af21-218512c370a1%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/75099ba4-550d-4a70-af21-218512c370a1%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/75099ba4-550d-4a70-<wbr>af21-=
218512c370a1%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>
</blockquote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/27926686-b222-4194-b606-c52d4a424e9e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/27926686-b222-4194-b606-c52d4a424e9e=
%40isocpp.org</a>.<br />

------=_Part_13233_56722883.1527252444442--

------=_Part_13232_821710418.1527252444442--

.


Author: =?UTF-8?B?R2HFoXBlciBBxb5tYW4=?= <gasper.azman@gmail.com>
Date: Fri, 25 May 2018 13:49:10 +0100
Raw View
--000000000000f4a44b056d073209
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Vlad,

these are all good points. Are you writing the paper?

I'm really not able to take on another paper at this point, and std::string
is not one of my primary focuses.

Ga=C5=A1per

On Fri, May 25, 2018 at 1:47 PM, 'Vlad from Moscow' via ISO C++ Standard -
Future Proposals <std-proposals@isocpp.org> wrote:

> You can consider the overload
>
> basic_string substr( const_iterator first, const_iterator last ) const;
>
> as a counterpart of the overload
>
> iterator erase(const_iterator first, const_iterator last);
>
>
> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 15:19:25 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Ga=C5=A1per A=C5=BEman =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=
=D0=B0=D0=BB:
>>
>> Honestly that's a problem I've had for a long time. Also, it's not a
>> template method (depends on string's const_iterator).
>>
>> While it's true string is overly complex... I do think providing these a=
t
>> this point is a good idea.
>> G
>>
>> On Fri, May 25, 2018 at 1:15 PM, 'Vlad from Moscow' via ISO C++ Standard
>> - Future Proposals <std-pr...@isocpp.org> wrote:
>>
>>> Take also into account that for the last shown record you can substitut=
e
>>> the iterator first for a call of a standard algorithm and the record wi=
ll
>>> be still readable. For example
>>>
>>> s.substr( std::find_if_not( std::begin( s ), std::end( s ), ::isspace )=
,
>>> last.base() );
>>>
>>>
>>>
>>> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 15:07:58 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Vlad from Moscow
>>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>>
>>>> It is easy to convert but it is difficult to read.:)
>>>>
>>>> For example if you have two iterators first and last (let's also assum=
e
>>>> that the iterator last is a reverse iterator) then you have to write
>>>>
>>>> s.substr( std::distance( std::begin( s ), first ), std::distance( firs=
t
>>>> , last.base() ) );
>>>>
>>>> As you can see the record is too complicated. It would be more readabl=
e
>>>> to present the call like
>>>>
>>>> s.substr( first, last.base() );
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> =D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018=
 =D0=B3., 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=
=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas
>>>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>>>
>>>>> On Thursday, May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrot=
e:
>>>>>>
>>>>>> For example either you need to use the standard C function ::isspace
>>>>>> and standard find algorithms or you can use some kind of the find al=
gorithm
>>>>>> of the class itself.
>>>>>>
>>>>>
>>>>> Considering how easy it is to convert from pos/n format to iterator
>>>>> pairs and vice-versa, why would you put the actual getting of the sub=
string
>>>>> inside of the condition? The condition's job is to get the range to
>>>>> extract; it doesn't need to actually do the extraction. You pick the
>>>>> convention you need to work with, and if some code needs to use the o=
ther
>>>>> form, you convert for its sake, then convert back once that's done.
>>>>>
>>>> --
>>> 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-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> To view this discussion on the web visit https://groups.google.com/a/is
>>> ocpp.org/d/msgid/std-proposals/75099ba4-550d-4a70-af21-
>>> 218512c370a1%40isocpp.org
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/75099ba4-=
550d-4a70-af21-218512c370a1%40isocpp.org?utm_medium=3Demail&utm_source=3Dfo=
oter>
>>> .
>>>
>>
>> --
> 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.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/27926686-b222-4194-
> b606-c52d4a424e9e%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/27926686-b2=
22-4194-b606-c52d4a424e9e%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAANG%3DkX8i-grXYsy_rOk4yMu8VhMkqi8-9HFikhJYpZqx=
OG7Yg%40mail.gmail.com.

--000000000000f4a44b056d073209
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Vlad,<div><br></div><div>these are all good points. Are yo=
u writing the paper?</div><div><br></div><div>I&#39;m really not able to ta=
ke on another paper at this point, and std::string is not one of my primary=
 focuses.</div><div><br></div><div>Ga=C5=A1per</div></div><div class=3D"gma=
il_extra"><br><div class=3D"gmail_quote">On Fri, May 25, 2018 at 1:47 PM, &=
#39;Vlad from Moscow&#39; via ISO C++ Standard - Future Proposals <span dir=
=3D"ltr">&lt;<a href=3D"mailto:std-proposals@isocpp.org" target=3D"_blank">=
std-proposals@isocpp.org</a>&gt;</span> wrote:<br><blockquote class=3D"gmai=
l_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div dir=3D"ltr">You can consider the overload=C2=A0<span class=3D"gm=
ail-"><br><br><div class=3D"gmail-m_-1200231721445171036prettyprint" style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code class=3D"gmail-m_-=
1200231721445171036prettyprint"><div class=3D"gmail-m_-1200231721445171036s=
ubprettyprint"><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(0,=
0,0)" class=3D"gmail-m_-1200231721445171036styled-by-prettify">basic_string=
 substr</span></span><span style=3D"color:rgb(102,102,0)"><span style=3D"co=
lor:rgb(102,102,0)" class=3D"gmail-m_-1200231721445171036styled-by-prettify=
">(</span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(=
0,0,0)" class=3D"gmail-m_-1200231721445171036styled-by-prettify"> const_ite=
rator first</span></span><span style=3D"color:rgb(102,102,0)"><span style=
=3D"color:rgb(102,102,0)" class=3D"gmail-m_-1200231721445171036styled-by-pr=
ettify">,</span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"colo=
r:rgb(0,0,0)" class=3D"gmail-m_-1200231721445171036styled-by-prettify"> con=
st_iterator </span></span><span style=3D"color:rgb(0,0,136)"><span style=3D=
"color:rgb(0,0,136)" class=3D"gmail-m_-1200231721445171036styled-by-prettif=
y">last</span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:=
rgb(0,0,0)" class=3D"gmail-m_-1200231721445171036styled-by-prettify"> </spa=
n></span><span style=3D"color:rgb(102,102,0)"><span style=3D"color:rgb(102,=
102,0)" class=3D"gmail-m_-1200231721445171036styled-by-prettify">)</span></=
span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(0,0,0)" clas=
s=3D"gmail-m_-1200231721445171036styled-by-prettify"> </span></span><span s=
tyle=3D"color:rgb(0,0,136)"><span style=3D"color:rgb(0,0,136)" class=3D"gma=
il-m_-1200231721445171036styled-by-prettify">const</span></span><span style=
=3D"color:rgb(102,102,0)"><span style=3D"color:rgb(102,102,0)" class=3D"gma=
il-m_-1200231721445171036styled-by-prettify">;</span></span><span style=3D"=
color:rgb(0,0,0)" class=3D"gmail-m_-1200231721445171036styled-by-prettify">=
<br></span></div></code></div><span style=3D"font-family:monospace;backgrou=
nd-color:rgb(250,250,250);color:rgb(102,102,0)"><br></span></span>as a coun=
terpart of the overload<div><br></div><div><div class=3D"gmail-m_-120023172=
1445171036prettyprint" style=3D"background-color:rgb(250,250,250);border-co=
lor:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-wo=
rd"><code class=3D"gmail-m_-1200231721445171036prettyprint"><div class=3D"g=
mail-m_-1200231721445171036subprettyprint"><span style=3D"color:rgb(0,0,0)"=
 class=3D"gmail-m_-1200231721445171036styled-by-prettify">iterator erase</s=
pan><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-1200231721445171=
036styled-by-prettify">(</span><span style=3D"color:rgb(0,0,0)" class=3D"gm=
ail-m_-1200231721445171036styled-by-prettify">const_iterator first</span><s=
pan style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-1200231721445171036sty=
led-by-prettify">,</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_=
-1200231721445171036styled-by-prettify"> const_iterator </span><span style=
=3D"color:rgb(0,0,136)" class=3D"gmail-m_-1200231721445171036styled-by-pret=
tify">last</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-120=
0231721445171036styled-by-prettify">);</span></div></code></div><br><br>=D0=
=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3.=
, 15:19:25 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=
=B5=D0=BB=D1=8C Ga=C5=A1per A=C5=BEman =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=
=D0=BB:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=3D"gma=
il-"><div dir=3D"ltr">Honestly that&#39;s a problem I&#39;ve had for a long=
 time. Also, it&#39;s not a template method (depends on string&#39;s const_=
iterator).<div><br></div><div>While it&#39;s true string is overly complex.=
... I do think providing these at this point is a good idea.</div><div>G</di=
v></div></span><div><br><div class=3D"gmail_quote"><span class=3D"gmail-">O=
n Fri, May 25, 2018 at 1:15 PM, &#39;Vlad from Moscow&#39; via ISO C++ Stan=
dard - Future Proposals <span dir=3D"ltr">&lt;<a rel=3D"nofollow">std-pr...=
@isocpp.org</a>&gt;</span> wrote:<br></span><blockquote class=3D"gmail_quot=
e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)=
;padding-left:1ex"><span class=3D"gmail-"><div dir=3D"ltr">Take also into a=
ccount that for the last shown record you can substitute the iterator first=
 for a call of a standard algorithm and the record will be still readable. =
For example<div><br></div><div><div style=3D"background-color:rgb(250,250,2=
50);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-=
wrap:break-word"><code><div><span style=3D"color:rgb(0,0,0)">s</span><span =
style=3D"color:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">sub=
str</span><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color=
:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102,0)">::</span><span=
 style=3D"color:rgb(0,0,0)">find_if_not</span><span style=3D"color:rgb(102,=
102,0)">(</span><span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"=
color:rgb(102,102,0)">::</span><span style=3D"color:rgb(0,0,136)">begin</sp=
an><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,=
0,0)"> s </span><span style=3D"color:rgb(102,102,0)">),</span><span style=
=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102,0)">:</sp=
an><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,=
0,136)">end</span><span style=3D"color:rgb(102,102,0)">(</span><span style=
=3D"color:rgb(0,0,0)"> s </span><span style=3D"color:rgb(102,102,0)">),</sp=
an><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,10=
2,0)">::</span><span style=3D"color:rgb(0,0,0)">isspace </span><span style=
=3D"color:rgb(102,102,0)">),</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(0,0,136)">last</span><span style=3D"color:rgb(102=
,102,0)">.</span><span style=3D"color:rgb(0,0,136)">base</span><span style=
=3D"color:rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(102,102,0)">);</span></div></code></div><br><br><=
br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 15:07:58 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Vlad from Moscow =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=
=D0=BB:<span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"=
ltr">It is easy to convert but it is difficult to read.:)<div><br></div><di=
v>For example if you have two iterators first and last (let&#39;s also assu=
me that the iterator last is a reverse iterator) then you have to write</di=
v><div><br></div><div><div style=3D"background-color:rgb(250,250,250);borde=
r-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:brea=
k-word"><code><div><span style=3D"color:rgb(0,0,0)">s</span><span style=3D"=
color:rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,0)">substr</span=
><span style=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,=
0)"> std</span><span style=3D"color:rgb(102,102,0)">::</span><span style=3D=
"color:rgb(0,0,0)">distance</span><span style=3D"color:rgb(102,102,0)">(</s=
pan><span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(10=
2,102,0)">::</span><span style=3D"color:rgb(0,0,136)">begin</span><span sty=
le=3D"color:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> s </s=
pan><span style=3D"color:rgb(102,102,0)">),</span><span style=3D"color:rgb(=
0,0,0)"> first </span><span style=3D"color:rgb(102,102,0)">),</span><span s=
tyle=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102,0)">:=
:</span><span style=3D"color:rgb(0,0,0)">distance</span><span style=3D"colo=
r:rgb(102,102,0)">(</span><span style=3D"color:rgb(0,0,0)"> first</span><sp=
an style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)">=
 </span><span style=3D"color:rgb(0,0,136)">last</span><span style=3D"color:=
rgb(102,102,0)">.</span><span style=3D"color:rgb(0,0,136)">base</span><span=
 style=3D"color:rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> =
</span><span style=3D"color:rgb(102,102,0)">)</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">);</span></div></cod=
e></div><br></div><div>As you can see the record is too complicated. It wou=
ld be more readable to present the call like</div><div><br></div><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:rgb(0,0,0)">s</span><span style=3D"color:rgb(102,102,0)">.</span>=
<span style=3D"color:rgb(0,0,0)">substr</span><span style=3D"color:rgb(102,=
102,0)">(</span><span style=3D"color:rgb(0,0,0)"> first</span><span style=
=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(0,0,136)">last</span><span style=3D"color:rgb(102,=
102,0)">.</span><span style=3D"color:rgb(0,0,136)">base</span><span style=
=3D"color:rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> </span=
><span style=3D"color:rgb(102,102,0)">);</span><span style=3D"color:rgb(0,0=
,0)"><br><br></span></div></code></div><div><br><br></div><div><br><br>=D1=
=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 24 =D0=BC=D0=B0=D1=8F 2018 =D0=B3.=
, 20:08:36 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=
=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blo=
ckquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left=
:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">On Thursday,=
 May 24, 2018 at 11:25:08 AM UTC-4, Vlad from Moscow wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid r=
gb(204,204,204);padding-left:1ex"><div dir=3D"ltr">For example either you n=
eed to use the standard C function ::isspace and standard find algorithms o=
r you can use some kind of the find algorithm of the class itself.<br></div=
></blockquote><div><br></div><div>Considering how easy it is to convert fro=
m pos/n format to iterator pairs and vice-versa, why would you put the actu=
al getting of the substring inside of the condition? The condition&#39;s jo=
b is to get the range to extract; it doesn&#39;t need to actually do the ex=
traction. You pick the convention you need to work with, and if some code n=
eeds to use the other form, you convert for its sake, then convert back onc=
e that&#39;s done.</div></div></blockquote></div></div></blockquote></span>=
</div></div></span><span><span class=3D"gmail-">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br></span>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<br></span><span class=3D"gmail-">
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/75099ba4-550d-4a70-af21-218512c370a1%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank">https://groups.google.com/a/is<wbr>ocpp.org/d/msgid/std-pr=
oposals<wbr>/75099ba4-550d-4a70-af21-<wbr>218512c370a1%40isocpp.org</a>.<br=
>
</span></blockquote></div><br></div>
</blockquote></div></div><span class=3D"gmail-">

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/27926686-b222-4194-b606-c52d4a424e9e%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/2792=
6686-b222-4194-<wbr>b606-c52d4a424e9e%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkX8i-grXYsy_rOk4yMu8VhMkqi8-9=
HFikhJYpZqxOG7Yg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkX8i-gr=
XYsy_rOk4yMu8VhMkqi8-9HFikhJYpZqxOG7Yg%40mail.gmail.com</a>.<br />

--000000000000f4a44b056d073209--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 25 May 2018 07:01:34 -0700 (PDT)
Raw View
------=_Part_13754_1054992818.1527256894857
Content-Type: multipart/alternative;
 boundary="----=_Part_13755_1851237815.1527256894857"

------=_Part_13755_1851237815.1527256894857
Content-Type: text/plain; charset="UTF-8"

On Friday, May 25, 2018 at 8:07:58 AM UTC-4, Vlad from Moscow wrote:
>
> It is easy to convert but it is difficult to read.:)
>
> For example if you have two iterators first and last (let's also assume
> that the iterator last is a reverse iterator) then you have to write
>
> s.substr( std::distance( std::begin( s ), first ), std::distance( first,
> last.base() ) );
>
>
That's only true if you insist on writing it in the least readable way
possible. Most people would just do:

s.substr(s.begin() - first, first - last.base());

It's not like we don't know that these are random-access iterators or
something.


> As you can see the record is too complicated. It would be more readable to
> present the call like
>
> s.substr( first, last.base() );
>
>
>

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/b2ce390f-302f-49e0-b2a3-a6df5ac57352%40isocpp.org.

------=_Part_13755_1851237815.1527256894857
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, May 25, 2018 at 8:07:58 AM UTC-4, Vlad from Mos=
cow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">It =
is easy to convert but it is difficult to read.:)<div><br></div><div>For ex=
ample if you have two iterators first and last (let&#39;s also assume that =
the iterator last is a reverse iterator) then you have to write</div><div><=
br></div><div><div style=3D"background-color:rgb(250,250,250);border-color:=
rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word">=
<code><div><span style=3D"color:#000">s</span><span style=3D"color:#660">.<=
/span><span style=3D"color:#000">substr</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::</=
span><span style=3D"color:#000">distance</span><span style=3D"color:#660">(=
</span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::<=
/span><span style=3D"color:#008">begin</span><span style=3D"color:#660">(</=
span><span style=3D"color:#000"> s </span><span style=3D"color:#660">),</sp=
an><span style=3D"color:#000"> first </span><span style=3D"color:#660">),</=
span><span style=3D"color:#000"> std</span><span style=3D"color:#660">::</s=
pan><span style=3D"color:#000">distance</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000"> first</span><span style=3D"color:#660">,<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#008">last</s=
pan><span style=3D"color:#660">.</span><span style=3D"color:#008">base</spa=
n><span style=3D"color:#660">()</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#660">)</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">);</span></div></code></div><br></div></div></blockquot=
e><div><br></div><div>That&#39;s only true if you insist on writing it in t=
he least readable way possible. Most people would just do:</div><div><br></=
div><div><div style=3D"background-color: rgb(250, 250, 250); border-color: =
rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: =
break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">substr</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">s</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">begin</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">-</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f=
irst</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> first </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">-</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">last</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">.</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">base</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">());</span></div></code></div><br></div><div></div>It&#39=
;s not like we don&#39;t know that these are random-access iterators or som=
ething.<br><div></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-lef=
t: 1ex;"><div dir=3D"ltr"><div></div><div>As you can see the record is too =
complicated. It would be more readable to present the call like</div><div><=
br></div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(1=
87,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code=
><div><span style=3D"color:#000">s</span><span style=3D"color:#660">.</span=
><span style=3D"color:#000">substr</span><span style=3D"color:#660">(</span=
><span style=3D"color:#000"> first</span><span style=3D"color:#660">,</span=
><span style=3D"color:#000"> </span><span style=3D"color:#008">last</span><=
span style=3D"color:#660">.</span><span style=3D"color:#008">base</span><sp=
an style=3D"color:#660">()</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">);</span><span style=3D"color:#000"><br><br></span></di=
v></code></div><br></div></blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b2ce390f-302f-49e0-b2a3-a6df5ac57352%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b2ce390f-302f-49e0-b2a3-a6df5ac57352=
%40isocpp.org</a>.<br />

------=_Part_13755_1851237815.1527256894857--

------=_Part_13754_1054992818.1527256894857--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 25 May 2018 07:16:15 -0700 (PDT)
Raw View
------=_Part_11217_2104653057.1527257775530
Content-Type: multipart/alternative;
 boundary="----=_Part_11218_1634292127.1527257775531"

------=_Part_11218_1634292127.1527257775531
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Why not just write

s.substr( first, last.base() );


instead of

s.substr(s.begin() - first, first - last.base());

?

And as for me I try to use a general approach instead of an approach that=
=20
depends on a peculiraty. So in generdal  I prefer to use std::distance.

As I already said the overload

basic_string substr( const_iterator first, const_iterator last ) const;

is a counterpart of the overload

iterator erase(const_iterator first, const_iterator last);

The first one extracts a substring while the second one erases a substring.

Iterators are the most important part of containers and algorithms in=20
particular and of C++ in whole. So we should not ignore them in built-in=20
algorithms of containers if there is no standard algorithm that can do the=
=20
same so expressive and easy.

=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 17:01:34 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> On Friday, May 25, 2018 at 8:07:58 AM UTC-4, Vlad from Moscow wrote:
>>
>> It is easy to convert but it is difficult to read.:)
>>
>> For example if you have two iterators first and last (let's also assume=
=20
>> that the iterator last is a reverse iterator) then you have to write
>>
>> s.substr( std::distance( std::begin( s ), first ), std::distance( first,=
=20
>> last.base() ) );
>>
>>
> That's only true if you insist on writing it in the least readable way=20
> possible. Most people would just do:
>
> s.substr(s.begin() - first, first - last.base());
>
> It's not like we don't know that these are random-access iterators or=20
> something.
> =20
>
>> As you can see the record is too complicated. It would be more readable=
=20
>> to present the call like
>>
>> s.substr( first, last.base() );
>>
>>
>>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/0850d8bc-4b8e-4f10-b7e0-ecff169bd957%40isocpp.or=
g.

------=_Part_11218_1634292127.1527257775531
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Why not just write<div><br></div><div><div class=3D"pretty=
print" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187=
, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;=
"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"=
color: #000;" class=3D"styled-by-prettify">s</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">substr</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> first</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">last</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">base</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">);</span></div></code></div><br></div><div><br><=
/div><div>instead of</div><div><br></div><div><div class=3D"prettyprint" st=
yle=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 18=
7); border-style: solid; border-width: 1px; word-wrap: break-word;"><code c=
lass=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">s</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">substr</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">begin</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">-</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> first</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> first </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">-</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">last<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">base</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">());</span></div></code></=
div><span style=3D"font-family: monospace; background-color: rgb(250, 250, =
250); color: rgb(102, 102, 0);"><br></span>?</div><div><br></div><div>And a=
s for me I try to use a general approach instead of an approach that depend=
s on a peculiraty. So in generdal=C2=A0 I prefer to use std::distance.</div=
><div><br></div><div>As I already said the overload</div><div><br></div><di=
v><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250);=
 border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; =
word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpretty=
print"><span style=3D"color: #000;" class=3D"styled-by-prettify">basic_stri=
ng substr</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> const_ite=
rator first</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> const_i=
terator </span><span style=3D"color: #008;" class=3D"styled-by-prettify">la=
st</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span></div></code></div><span style=
=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: rg=
b(102, 102, 0);"><br></span>is a counterpart of the overload</div><div><br>=
</div><div><div class=3D"prettyprint" style=3D"background-color: rgb(250, 2=
50, 250); border-color: rgb(187, 187, 187); border-style: solid; border-wid=
th: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"=
subprettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify">i=
terator erase</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">const_=
iterator first</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> cons=
t_iterator </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>last</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan></div></code></div><span style=3D"font-family: monospace; background-co=
lor: rgb(250, 250, 250); color: rgb(102, 102, 0);"><br></span>The first one=
 extracts a substring while the second one erases a substring.</div><div><b=
r></div><div>Iterators are the most important part of containers and algori=
thms in particular and of C++ in whole. So we should not ignore them in bui=
lt-in algorithms of containers if there is no standard algorithm that can d=
o the same so expressive and easy.<br><br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=
=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 17:01:34 UTC+3 =D0=BF=D0=BE=
=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;"><div dir=3D"ltr">On Friday, May 25, 2018 at 8:07:58 AM UTC-4, =
Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;=
margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"=
ltr">It is easy to convert but it is difficult to read.:)<div><br></div><di=
v>For example if you have two iterators first and last (let&#39;s also assu=
me that the iterator last is a reverse iterator) then you have to write</di=
v><div><br></div><div><div style=3D"background-color:rgb(250,250,250);borde=
r-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:brea=
k-word"><code><div><span style=3D"color:#000">s</span><span style=3D"color:=
#660">.</span><span style=3D"color:#000">substr</span><span style=3D"color:=
#660">(</span><span style=3D"color:#000"> std</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#000">distance</span><span style=3D"color=
:#660">(</span><span style=3D"color:#000"> std</span><span style=3D"color:#=
660">::</span><span style=3D"color:#008">begin</span><span style=3D"color:#=
660">(</span><span style=3D"color:#000"> s </span><span style=3D"color:#660=
">),</span><span style=3D"color:#000"> first </span><span style=3D"color:#6=
60">),</span><span style=3D"color:#000"> std</span><span style=3D"color:#66=
0">::</span><span style=3D"color:#000">distance</span><span style=3D"color:=
#660">(</span><span style=3D"color:#000"> first</span><span style=3D"color:=
#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008"=
>last</span><span style=3D"color:#660">.</span><span style=3D"color:#008">b=
ase</span><span style=3D"color:#660">()</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </span=
><span style=3D"color:#660">);</span></div></code></div><br></div></div></b=
lockquote><div><br></div><div>That&#39;s only true if you insist on writing=
 it in the least readable way possible. Most people would just do:</div><di=
v><br></div><div><div style=3D"background-color:rgb(250,250,250);border-col=
or:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span s=
tyle=3D"color:#000">s</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">substr</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">s</span><span style=3D"color:#660">.</span><span style=3D"c=
olor:#008">begin</span><span style=3D"color:#660">()</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">-</span><span style=3D"color:=
#000"> first</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> first </span><span style=3D"color:#660">-</span><span style=3D"color=
:#000"> </span><span style=3D"color:#008">last</span><span style=3D"color:#=
660">.</span><span style=3D"color:#008">base</span><span style=3D"color:#66=
0">());</span></div></code></div><br></div><div></div>It&#39;s not like we =
don&#39;t know that these are random-access iterators or something.<br><div=
></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0=
;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D=
"ltr"><div></div><div>As you can see the record is too complicated. It woul=
d be more readable to present the call like</div><div><br></div><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#000">s</span><span style=3D"color:#660">.</span><span style=3D"c=
olor:#000">substr</span><span style=3D"color:#660">(</span><span style=3D"c=
olor:#000"> first</span><span style=3D"color:#660">,</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#008">last</span><span style=3D"col=
or:#660">.</span><span style=3D"color:#008">base</span><span style=3D"color=
:#660">()</span><span style=3D"color:#000"> </span><span style=3D"color:#66=
0">);</span><span style=3D"color:#000"><br><br></span></div></code></div><b=
r></div></blockquote></div></blockquote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0850d8bc-4b8e-4f10-b7e0-ecff169bd957%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0850d8bc-4b8e-4f10-b7e0-ecff169bd957=
%40isocpp.org</a>.<br />

------=_Part_11218_1634292127.1527257775531--

------=_Part_11217_2104653057.1527257775530--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 25 May 2018 07:22:09 -0700 (PDT)
Raw View
------=_Part_5597_1993668836.1527258129246
Content-Type: multipart/alternative;
 boundary="----=_Part_5598_1110675784.1527258129246"

------=_Part_5598_1110675784.1527258129246
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

One more example of using the overload that is readable and clear

s.substr( std::begin( s ), std::find_if( std::begin( s ), std::end( s ), ::=
isspace=20
) )


This expression can be used for example as a part of some loop.

=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 17:01:34 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> On Friday, May 25, 2018 at 8:07:58 AM UTC-4, Vlad from Moscow wrote:
>>
>> It is easy to convert but it is difficult to read.:)
>>
>> For example if you have two iterators first and last (let's also assume=
=20
>> that the iterator last is a reverse iterator) then you have to write
>>
>> s.substr( std::distance( std::begin( s ), first ), std::distance( first,=
=20
>> last.base() ) );
>>
>>
> That's only true if you insist on writing it in the least readable way=20
> possible. Most people would just do:
>
> s.substr(s.begin() - first, first - last.base());
>
> It's not like we don't know that these are random-access iterators or=20
> something.
> =20
>
>> As you can see the record is too complicated. It would be more readable=
=20
>> to present the call like
>>
>> s.substr( first, last.base() );
>>
>>
>>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/241c2c4c-b564-41b9-843c-1c8ac5829c9f%40isocpp.or=
g.

------=_Part_5598_1110675784.1527258129246
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">One more example of using the overload that is readable an=
d clear<div><br></div><div><div class=3D"prettyprint" style=3D"background-c=
olor: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: s=
olid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint=
"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"style=
d-by-prettify">s</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">sub=
str</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">begin</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> s </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">),</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">find_if</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">begin</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> s </span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">),</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">end</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> s </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">),</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">isspace </span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br><br></span></div></code></div><br>This expression can be used=
 for example as a part of some loop.</div><div><br>=D0=BF=D1=8F=D1=82=D0=BD=
=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 17:01:34 UTC+3 =D0=
=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol=
 Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmai=
l_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;=
padding-left: 1ex;"><div dir=3D"ltr">On Friday, May 25, 2018 at 8:07:58 AM =
UTC-4, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr">It is easy to convert but it is difficult to read.:)<div><br></=
div><div>For example if you have two iterators first and last (let&#39;s al=
so assume that the iterator last is a reverse iterator) then you have to wr=
ite</div><div><br></div><div><div style=3D"background-color:rgb(250,250,250=
);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wr=
ap:break-word"><code><div><span style=3D"color:#000">s</span><span style=3D=
"color:#660">.</span><span style=3D"color:#000">substr</span><span style=3D=
"color:#660">(</span><span style=3D"color:#000"> std</span><span style=3D"c=
olor:#660">::</span><span style=3D"color:#000">distance</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000"> std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#008">begin</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000"> s </span><span style=3D=
"color:#660">),</span><span style=3D"color:#000"> first </span><span style=
=3D"color:#660">),</span><span style=3D"color:#000"> std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">distance</span><span st=
yle=3D"color:#660">(</span><span style=3D"color:#000"> first</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">last</span><span style=3D"color:#660">.</span><span style=
=3D"color:#008">base</span><span style=3D"color:#660">()</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">)</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">);</span></div></code></div><=
br></div></div></blockquote><div><br></div><div>That&#39;s only true if you=
 insist on writing it in the least readable way possible. Most people would=
 just do:</div><div><br></div><div><div style=3D"background-color:rgb(250,2=
50,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px">=
<code><div><span style=3D"color:#000">s</span><span style=3D"color:#660">.<=
/span><span style=3D"color:#000">substr</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000">s</span><span style=3D"color:#660">.</span=
><span style=3D"color:#008">begin</span><span style=3D"color:#660">()</span=
><span style=3D"color:#000"> </span><span style=3D"color:#660">-</span><spa=
n style=3D"color:#000"> first</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> first </span><span style=3D"color:#660">-</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#008">last</span><span=
 style=3D"color:#660">.</span><span style=3D"color:#008">base</span><span s=
tyle=3D"color:#660">());</span></div></code></div><br></div><div></div>It&#=
39;s not like we don&#39;t know that these are random-access iterators or s=
omething.<br><div></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" =
style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div dir=3D"ltr"><div></div><div>As you can see the record is too com=
plicated. It would be more readable to present the call like</div><div><br>=
</div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,=
187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><d=
iv><span style=3D"color:#000">s</span><span style=3D"color:#660">.</span><s=
pan style=3D"color:#000">substr</span><span style=3D"color:#660">(</span><s=
pan style=3D"color:#000"> first</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#008">last</span><spa=
n style=3D"color:#660">.</span><span style=3D"color:#008">base</span><span =
style=3D"color:#660">()</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#660">);</span><span style=3D"color:#000"><br><br></span></div><=
/code></div><br></div></blockquote></div></blockquote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/241c2c4c-b564-41b9-843c-1c8ac5829c9f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/241c2c4c-b564-41b9-843c-1c8ac5829c9f=
%40isocpp.org</a>.<br />

------=_Part_5598_1110675784.1527258129246--

------=_Part_5597_1993668836.1527258129246--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 25 May 2018 07:45:42 -0700 (PDT)
Raw View
------=_Part_13786_1522859945.1527259543035
Content-Type: multipart/alternative;
 boundary="----=_Part_13787_1980938911.1527259543036"

------=_Part_13787_1980938911.1527259543036
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

According to your approach we could exclude the member function

iterator erase(const_iterator first, const_iterator last);

from the C++ Standard because it can be substituted for the member function

basic_string& erase(size_type pos =3D 0, size_type n =3D npos);

And you already showed how this can be done.

However we are comfortable with the member function=20

iterator erase(const_iterator first, const_iterator last);

because usually the iterators are obtained by applying standard algorithms=
=20
to objects of the class std::basic_string.

In fact it can be considered as a Standard defect because the same=20
requirements exists for the member function substr.

=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 17:01:34 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> On Friday, May 25, 2018 at 8:07:58 AM UTC-4, Vlad from Moscow wrote:
>>
>> It is easy to convert but it is difficult to read.:)
>>
>> For example if you have two iterators first and last (let's also assume=
=20
>> that the iterator last is a reverse iterator) then you have to write
>>
>> s.substr( std::distance( std::begin( s ), first ), std::distance( first,=
=20
>> last.base() ) );
>>
>>
> That's only true if you insist on writing it in the least readable way=20
> possible. Most people would just do:
>
> s.substr(s.begin() - first, first - last.base());
>
> It's not like we don't know that these are random-access iterators or=20
> something.
> =20
>
>> As you can see the record is too complicated. It would be more readable=
=20
>> to present the call like
>>
>> s.substr( first, last.base() );
>>
>>
>>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/403ef5ee-3269-45c2-8a43-7daee11adc6a%40isocpp.or=
g.

------=_Part_13787_1980938911.1527259543036
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">According to your approach we could exclude the member fun=
ction<div><br></div><div><div class=3D"prettyprint" style=3D"background-col=
or: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: sol=
id; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint">=
<div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-=
by-prettify">iterator erase</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">const_iterator first</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> const_iterator </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">last</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">);</span></div></code></div><br>from the C++ Standard because it c=
an be substituted for the member function</div><div><br></div><div><div cla=
ss=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-co=
lor: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap:=
 break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">basic_string</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> erase</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">size_type pos </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" cl=
ass=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> size_type n </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> npos</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
);</span></div></code></div><br>And you already showed how this can be done=
..</div><div><br></div><div>However we are comfortable with the member funct=
ion=C2=A0</div><div><br><div class=3D"prettyprint" style=3D"background-colo=
r: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: soli=
d; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><=
div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">iterator erase</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">const_iterator first</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> const_iterator </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">last</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">);</span></div></code></div><span class=3D"styled-by-prettify" styl=
e=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: r=
gb(102, 102, 0);"><br></span>because usually the iterators are obtained by =
applying standard algorithms to objects of the class std::basic_string.</di=
v><div><br></div><div>In fact it can be considered as a Standard defect bec=
ause the same requirements exists for the member function substr.</div><div=
><br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018=
 =D0=B3., 17:01:34 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=
=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=
=D0=BB:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Fri=
day, May 25, 2018 at 8:07:58 AM UTC-4, Vlad from Moscow wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr">It is easy to convert but it is=
 difficult to read.:)<div><br></div><div>For example if you have two iterat=
ors first and last (let&#39;s also assume that the iterator last is a rever=
se iterator) then you have to write</div><div><br></div><div><div style=3D"=
background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-styl=
e:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"co=
lor:#000">s</span><span style=3D"color:#660">.</span><span style=3D"color:#=
000">substr</span><span style=3D"color:#660">(</span><span style=3D"color:#=
000"> std</span><span style=3D"color:#660">::</span><span style=3D"color:#0=
00">distance</span><span style=3D"color:#660">(</span><span style=3D"color:=
#000"> std</span><span style=3D"color:#660">::</span><span style=3D"color:#=
008">begin</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
00"> s </span><span style=3D"color:#660">),</span><span style=3D"color:#000=
"> first </span><span style=3D"color:#660">),</span><span style=3D"color:#0=
00"> std</span><span style=3D"color:#660">::</span><span style=3D"color:#00=
0">distance</span><span style=3D"color:#660">(</span><span style=3D"color:#=
000"> first</span><span style=3D"color:#660">,</span><span style=3D"color:#=
000"> </span><span style=3D"color:#008">last</span><span style=3D"color:#66=
0">.</span><span style=3D"color:#008">base</span><span style=3D"color:#660"=
>()</span><span style=3D"color:#000"> </span><span style=3D"color:#660">)</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">);</span=
></div></code></div><br></div></div></blockquote><div><br></div><div>That&#=
39;s only true if you insist on writing it in the least readable way possib=
le. Most people would just do:</div><div><br></div><div><div style=3D"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;border-width:1px"><code><div><span style=3D"color:#000">s</span><span st=
yle=3D"color:#660">.</span><span style=3D"color:#000">substr</span><span st=
yle=3D"color:#660">(</span><span style=3D"color:#000">s</span><span style=
=3D"color:#660">.</span><span style=3D"color:#008">begin</span><span style=
=3D"color:#660">()</span><span style=3D"color:#000"> </span><span style=3D"=
color:#660">-</span><span style=3D"color:#000"> first</span><span style=3D"=
color:#660">,</span><span style=3D"color:#000"> first </span><span style=3D=
"color:#660">-</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#008">last</span><span style=3D"color:#660">.</span><span style=3D"color:=
#008">base</span><span style=3D"color:#660">());</span></div></code></div><=
br></div><div></div>It&#39;s not like we don&#39;t know that these are rand=
om-access iterators or something.<br><div></div><div>=C2=A0</div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px=
 #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div></div><div>As you can s=
ee the record is too complicated. It would be more readable to present the =
call like</div><div><br></div><div style=3D"background-color:rgb(250,250,25=
0);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-w=
rap:break-word"><code><div><span style=3D"color:#000">s</span><span style=
=3D"color:#660">.</span><span style=3D"color:#000">substr</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000"> first</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">last</span><span style=3D"color:#660">.</span><span style=3D"col=
or:#008">base</span><span style=3D"color:#660">()</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#660">);</span><span style=3D"color:#0=
00"><br><br></span></div></code></div><br></div></blockquote></div></blockq=
uote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/403ef5ee-3269-45c2-8a43-7daee11adc6a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/403ef5ee-3269-45c2-8a43-7daee11adc6a=
%40isocpp.org</a>.<br />

------=_Part_13787_1980938911.1527259543036--

------=_Part_13786_1522859945.1527259543035--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 25 May 2018 07:57:13 -0700 (PDT)
Raw View
------=_Part_13604_1831047463.1527260233570
Content-Type: multipart/alternative;
 boundary="----=_Part_13605_405580646.1527260233570"

------=_Part_13605_405580646.1527260233570
Content-Type: text/plain; charset="UTF-8"

On Friday, May 25, 2018 at 10:16:15 AM UTC-4, Vlad from Moscow wrote:
>
> Why not just write
>
> s.substr( first, last.base() );
>
>
> instead of
>
> s.substr(s.begin() - first, first - last.base());
>
> ?
>

Because it's legal today.

As is:

string(first, last.base());

Which is no only shorter than your version, but it makes it abundantly
clear that you're *copying* characters. After all, if `string_view` had
been around when `basic_string` was being standardized, `substr` would
almost certainly have returned a `view`. Which means some people might
assume it does.

By using the constructor, you take away all possibility of doubt.

My overall problem with your idea is this: there are about 100 *far more
important* things for the standard's committee to be debating than a minor
change to a single function on `basic_string`. It's not necessarily that
your idea is wrong; it's that it is not nearly important enough for the
committee to bother with.

What you want to do can be done as is: employ `basic_string`'s constructor.
The status quo is adequate to your needs; all you're arguing for is a
different *spelling*.

Why is that worth committee time and effort?

And as for me I try to use a general approach instead of an approach that
> depends on a peculiraty.
>

That is not a "peculiarty". That is a *requirement of the standard*.
Relying on it is no more peculiar than relying on `std::distance`.


> So in generdal  I prefer to use std::distance.
>

Then you've chosen the path that leads to less readable code. That's not
the standard library's fault.

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/f069820a-d420-45f0-8422-ccec0f940613%40isocpp.org.

------=_Part_13605_405580646.1527260233570
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, May 25, 2018 at 10:16:15 AM UTC-4, Vlad from Mo=
scow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left=
: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">Wh=
y not just write<div><br></div><div><div style=3D"background-color:rgb(250,=
250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;=
word-wrap:break-word"><code><div><span style=3D"color:#000">s</span><span s=
tyle=3D"color:#660">.</span><span style=3D"color:#000">substr</span><span s=
tyle=3D"color:#660">(</span><span style=3D"color:#000"> first</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">last</span><span style=3D"color:#660">.</span><span style=
=3D"color:#008">base</span><span style=3D"color:#660">()</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">);</span></div></code></=
div><br></div><div><br></div><div>instead of</div><div><br></div><div><div =
style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bo=
rder-style:solid;border-width:1px;word-wrap:break-word"><code><div><span st=
yle=3D"color:#000">s</span><span style=3D"color:#660">.</span><span style=
=3D"color:#000">substr</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">s</span><span style=3D"color:#660">.</span><span style=3D"c=
olor:#008">begin</span><span style=3D"color:#660">()</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">-</span><span style=3D"color:=
#000"> first</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> first </span><span style=3D"color:#660">-</span><span style=3D"color=
:#000"> </span><span style=3D"color:#008">last</span><span style=3D"color:#=
660">.</span><span style=3D"color:#008">base</span><span style=3D"color:#66=
0">());</span></div></code></div><span style=3D"font-family:monospace;backg=
round-color:rgb(250,250,250);color:rgb(102,102,0)"><br></span>?</div></div>=
</blockquote><div><br></div><div>Because it&#39;s legal today.<br></div><di=
v><br></div><div>As is:</div><div><br></div><div><div style=3D"background-c=
olor: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: s=
olid; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint">=
<code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">string</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">first</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">last</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
..</span><span style=3D"color: #008;" class=3D"styled-by-prettify">base</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">());</span></di=
v></code></div><br></div><div>Which is no only shorter than your version, b=
ut it makes it abundantly clear that you&#39;re <i>copying</i> characters. =
After all, if `string_view` had been around when `basic_string` was being s=
tandardized, `substr` would almost certainly have returned a `view`. Which =
means some people might assume it does.</div><div><br></div><div>By using t=
he constructor, you take away all possibility of doubt.<br></div><div><br><=
/div><div><div>My overall problem with your idea is this: there are about 1=
00 <i>far more important</i>
 things for the standard&#39;s committee to be debating than a minor change=
=20
to a single function on `basic_string`. It&#39;s not necessarily that your =
idea is=20
wrong; it&#39;s that it is not nearly important enough for the committee to=
=20
bother with.</div><div><br></div><div>What you want to do can be done as is=
: employ `basic_string`&#39;s constructor. The status quo is adequate to yo=
ur needs; all you&#39;re arguing for is a different <i>spelling</i>.</div><=
div><br></div><div>Why is that worth committee time and effort?<br></div></=
div><div> <br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><div></div><div>And as for me I try to use a general approach inst=
ead of an approach that depends on a peculiraty.</div></div></blockquote><d=
iv><br></div><div>That is not a &quot;peculiarty&quot;. That is a <i>requir=
ement of the standard</i>. Relying on it is no more peculiar than relying o=
n `std::distance`.<br></div><div>=C2=A0</div><blockquote class=3D"gmail_quo=
te" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddi=
ng-left: 1ex;"><div dir=3D"ltr"><div> So in generdal=C2=A0 I prefer to use =
std::distance.</div></div></blockquote><div><br></div><div>Then you&#39;ve =
chosen the path that leads to less readable code. That&#39;s not the standa=
rd library&#39;s fault.<br></div><br></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/f069820a-d420-45f0-8422-ccec0f940613%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/f069820a-d420-45f0-8422-ccec0f940613=
%40isocpp.org</a>.<br />

------=_Part_13605_405580646.1527260233570--

------=_Part_13604_1831047463.1527260233570--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 25 May 2018 08:00:19 -0700 (PDT)
Raw View
------=_Part_8408_280644505.1527260419687
Content-Type: multipart/alternative;
 boundary="----=_Part_8409_486765273.1527260419687"

------=_Part_8409_486765273.1527260419687
Content-Type: text/plain; charset="UTF-8"



On Friday, May 25, 2018 at 10:45:43 AM UTC-4, Vlad from Moscow wrote:
>
> According to your approach we could exclude the member function
>
> iterator erase(const_iterator first, const_iterator last);
>
> from the C++ Standard because it can be substituted for the member function
>
> basic_string& erase(size_type pos = 0, size_type n = npos);
>
>
No, you can't. The iterator `erase` is a part of the sequence container
requirements, and `basic_string` is a sequence container. Therefore, it
*must* have such a function.

`substr` is *not* a part of the container requirements. So it's dealer's
choice.

And you already showed how this can be done.
>
> However we are comfortable with the member function
>
> iterator erase(const_iterator first, const_iterator last);
>
> because usually the iterators are obtained by applying standard algorithms
> to objects of the class std::basic_string.
>
> In fact it can be considered as a Standard defect because the same
> requirements exists for the member function substr.
>

No, it's not a defect. A defect is not an inconsistency; it's *brokenness*.
Being inconsistent is not being broken.

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/9ce11ce4-51ba-4fc9-8464-ec580e341056%40isocpp.org.

------=_Part_8409_486765273.1527260419687
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Friday, May 25, 2018 at 10:45:43 AM UTC-4, Vlad=
 from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr">According to your approach we could exclude the member function<div><=
br></div><div><div style=3D"background-color:rgb(250,250,250);border-color:=
rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word">=
<code><div><span style=3D"color:#000">iterator erase</span><span style=3D"c=
olor:#660">(</span><span style=3D"color:#000">const_iterator first</span><s=
pan style=3D"color:#660">,</span><span style=3D"color:#000"> const_iterator=
 </span><span style=3D"color:#008">last</span><span style=3D"color:#660">);=
</span></div></code></div><br>from the C++ Standard because it can be subst=
ituted for the member function</div><div><br></div><div><div style=3D"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#=
000">basic_string</span><span style=3D"color:#660">&amp;</span><span style=
=3D"color:#000"> erase</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">size_type pos </span><span style=3D"color:#660">=3D</span><=
span style=3D"color:#000"> </span><span style=3D"color:#066">0</span><span =
style=3D"color:#660">,</span><span style=3D"color:#000"> size_type n </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> npos</spa=
n><span style=3D"color:#660">);</span></div></code></div><br></div></div></=
blockquote><div><br></div><div>No, you can&#39;t. The iterator `erase` is a=
 part of the sequence container requirements, and `basic_string` is a seque=
nce container. Therefore, it <i>must</i> have such a function.<br></div><di=
v><br></div><div>`substr` is <i>not</i> a part of the container requirement=
s. So it&#39;s dealer&#39;s choice.<br></div><div><br></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #=
ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>And you already showed =
how this can be done.</div><div><br></div><div>However we are comfortable w=
ith the member function=C2=A0</div><div><br><div style=3D"background-color:=
rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wi=
dth:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">iterato=
r erase</span><span style=3D"color:#660">(</span><span style=3D"color:#000"=
>const_iterator first</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> const_iterator </span><span style=3D"color:#008">last</spa=
n><span style=3D"color:#660">);</span></div></code></div><span style=3D"fon=
t-family:monospace;background-color:rgb(250,250,250);color:rgb(102,102,0)">=
<br></span>because usually the iterators are obtained by applying standard =
algorithms to objects of the class std::basic_string.</div><div><br></div><=
div>In fact it can be considered as a Standard defect because the same requ=
irements exists for the member function substr.</div></div></blockquote><di=
v><br></div><div>No, it&#39;s not a defect. A defect is not an inconsistenc=
y; it&#39;s <i>brokenness</i>. Being inconsistent is not being broken.</div=
><br></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/9ce11ce4-51ba-4fc9-8464-ec580e341056%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9ce11ce4-51ba-4fc9-8464-ec580e341056=
%40isocpp.org</a>.<br />

------=_Part_8409_486765273.1527260419687--

------=_Part_8408_280644505.1527260419687--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Fri, 25 May 2018 08:11:04 -0700 (PDT)
Raw View
------=_Part_13572_2102682193.1527261064294
Content-Type: multipart/alternative;
 boundary="----=_Part_13573_1126532479.1527261064294"

------=_Part_13573_1126532479.1527261064294
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I agrree that the member function substr is a specific member function of=
=20
the class std::basic_string. Nevertheless the same approach should be used=
=20
as for the member function erase. There is no reason to separate approaches=
=20
to these functions and isolate the function substr.

=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
>
>
> On Friday, May 25, 2018 at 10:45:43 AM UTC-4, Vlad from Moscow wrote:
>>
>> According to your approach we could exclude the member function
>>
>> iterator erase(const_iterator first, const_iterator last);
>>
>> from the C++ Standard because it can be substituted for the member=20
>> function
>>
>> basic_string& erase(size_type pos =3D 0, size_type n =3D npos);
>>
>>
> No, you can't. The iterator `erase` is a part of the sequence container=
=20
> requirements, and `basic_string` is a sequence container. Therefore, it=
=20
> *must* have such a function.
>
> `substr` is *not* a part of the container requirements. So it's dealer's=
=20
> choice.
>
> And you already showed how this can be done.
>>
>> However we are comfortable with the member function=20
>>
>> iterator erase(const_iterator first, const_iterator last);
>>
>> because usually the iterators are obtained by applying standard=20
>> algorithms to objects of the class std::basic_string.
>>
>> In fact it can be considered as a Standard defect because the same=20
>> requirements exists for the member function substr.
>>
>
> No, it's not a defect. A defect is not an inconsistency; it's *brokenness=
*.=20
> Being inconsistent is not being broken.
>
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%40isocpp.or=
g.

------=_Part_13573_1126532479.1527261064294
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I agrree that the member function substr is a specific mem=
ber function of the class std::basic_string. Nevertheless the same approach=
 should be used as for the member function erase. There is no reason to sep=
arate approaches to these functions and isolate the function substr.<br><br=
>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<=
blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bord=
er-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><br>On Fri=
day, May 25, 2018 at 10:45:43 AM UTC-4, Vlad from Moscow wrote:<blockquote =
class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #=
ccc solid;padding-left:1ex"><div dir=3D"ltr">According to your approach we =
could exclude the member function<div><br></div><div><div style=3D"backgrou=
nd-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;=
border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#000=
">iterator erase</span><span style=3D"color:#660">(</span><span style=3D"co=
lor:#000">const_iterator first</span><span style=3D"color:#660">,</span><sp=
an style=3D"color:#000"> const_iterator </span><span style=3D"color:#008">l=
ast</span><span style=3D"color:#660">);</span></div></code></div><br>from t=
he C++ Standard because it can be substituted for the member function</div>=
<div><br></div><div><div style=3D"background-color:rgb(250,250,250);border-=
color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-=
word"><code><div><span style=3D"color:#000">basic_string</span><span style=
=3D"color:#660">&amp;</span><span style=3D"color:#000"> erase</span><span s=
tyle=3D"color:#660">(</span><span style=3D"color:#000">size_type pos </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#066">0</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000"> size_type n </span><span style=3D"color:#660">=3D</spa=
n><span style=3D"color:#000"> npos</span><span style=3D"color:#660">);</spa=
n></div></code></div><br></div></div></blockquote><div><br></div><div>No, y=
ou can&#39;t. The iterator `erase` is a part of the sequence container requ=
irements, and `basic_string` is a sequence container. Therefore, it <i>must=
</i> have such a function.<br></div><div><br></div><div>`substr` is <i>not<=
/i> a part of the container requirements. So it&#39;s dealer&#39;s choice.<=
br></div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0=
;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D=
"ltr"><div>And you already showed how this can be done.</div><div><br></div=
><div>However we are comfortable with the member function=C2=A0</div><div><=
br><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187=
,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div>=
<span style=3D"color:#000">iterator erase</span><span style=3D"color:#660">=
(</span><span style=3D"color:#000">const_iterator first</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> const_iterator </span><=
span style=3D"color:#008">last</span><span style=3D"color:#660">);</span></=
div></code></div><span style=3D"font-family:monospace;background-color:rgb(=
250,250,250);color:rgb(102,102,0)"><br></span>because usually the iterators=
 are obtained by applying standard algorithms to objects of the class std::=
basic_string.</div><div><br></div><div>In fact it can be considered as a St=
andard defect because the same requirements exists for the member function =
substr.</div></div></blockquote><div><br></div><div>No, it&#39;s not a defe=
ct. A defect is not an inconsistency; it&#39;s <i>brokenness</i>. Being inc=
onsistent is not being broken.</div><br></div></blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a=
%40isocpp.org</a>.<br />

------=_Part_13573_1126532479.1527261064294--

------=_Part_13572_2102682193.1527261064294--

.


Author: =?UTF-8?Q?Micha=C5=82_Dominiak?= <griwes@griwes.info>
Date: Fri, 25 May 2018 17:25:09 +0200
Raw View
--000000000000fdcdbd056d095ffb
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

There *is* a reason: what you want doesn't need to access the string object
itself. erase does.

On Fri, May 25, 2018 at 5:11 PM 'Vlad from Moscow' via ISO C++ Standard -
Future Proposals <std-proposals@isocpp.org> wrote:

> I agrree that the member function substr is a specific member function of
> the class std::basic_string. Nevertheless the same approach should be use=
d
> as for the member function erase. There is no reason to separate approach=
es
> to these functions and isolate the function substr.
>
> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
>
>>
>>
>> On Friday, May 25, 2018 at 10:45:43 AM UTC-4, Vlad from Moscow wrote:
>>>
>>> According to your approach we could exclude the member function
>>>
>>> iterator erase(const_iterator first, const_iterator last);
>>>
>>> from the C++ Standard because it can be substituted for the member
>>> function
>>>
>>> basic_string& erase(size_type pos =3D 0, size_type n =3D npos);
>>>
>>>
>> No, you can't. The iterator `erase` is a part of the sequence container
>> requirements, and `basic_string` is a sequence container. Therefore, it
>> *must* have such a function.
>>
>> `substr` is *not* a part of the container requirements. So it's dealer's
>> choice.
>>
>> And you already showed how this can be done.
>>>
>>> However we are comfortable with the member function
>>>
>>> iterator erase(const_iterator first, const_iterator last);
>>>
>>> because usually the iterators are obtained by applying standard
>>> algorithms to objects of the class std::basic_string.
>>>
>>> In fact it can be considered as a Standard defect because the same
>>> requirements exists for the member function substr.
>>>
>>
>> No, it's not a defect. A defect is not an inconsistency; it's
>> *brokenness*. Being inconsistent is not being broken.
>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce=
3-4c10-b211-01b01ddb817a%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0c=
e3-4c10-b211-01b01ddb817a%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAPCFJdQnpHh_ra-YrKNASZkb2RY6_2n8_GkLiQOeTMPmxXp=
j6A%40mail.gmail.com.

--000000000000fdcdbd056d095ffb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">There <i>is</i>=C2=A0a reason: what you want doesn&#39;t n=
eed to access the string object itself. erase does.</div><br><div class=3D"=
gmail_quote"><div dir=3D"ltr">On Fri, May 25, 2018 at 5:11 PM &#39;Vlad fro=
m Moscow&#39; via ISO C++ Standard - Future Proposals &lt;<a href=3D"mailto=
:std-proposals@isocpp.org">std-proposals@isocpp.org</a>&gt; wrote:<br></div=
><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1=
px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I agrree that the member f=
unction substr is a specific member function of the class std::basic_string=
.. Nevertheless the same approach should be used as for the member function =
erase. There is no reason to separate approaches to these functions and iso=
late the function substr.<br><br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0=
, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=
=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=
=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:</div><div dir=3D"ltr"><blockquote class=
=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><div dir=3D"ltr"><br><br>On Friday, May 25, 2018 at =
10:45:43 AM UTC-4, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote"=
 style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-lef=
t:1ex"><div dir=3D"ltr">According to your approach we could exclude the mem=
ber function<div><br></div><div><div style=3D"background-color:rgb(250,250,=
250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word=
-wrap:break-word"><code><div><span style=3D"color:#000">iterator erase</spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#000">const_itera=
tor first</span><span style=3D"color:#660">,</span><span style=3D"color:#00=
0"> const_iterator </span><span style=3D"color:#008">last</span><span style=
=3D"color:#660">);</span></div></code></div><br>from the C++ Standard becau=
se it can be substituted for the member function</div><div><br></div><div><=
div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187=
);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><spa=
n style=3D"color:#000">basic_string</span><span style=3D"color:#660">&amp;<=
/span><span style=3D"color:#000"> erase</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000">size_type pos </span><span style=3D"color:=
#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#06=
6">0</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> s=
ize_type n </span><span style=3D"color:#660">=3D</span><span style=3D"color=
:#000"> npos</span><span style=3D"color:#660">);</span></div></code></div><=
br></div></div></blockquote><div><br></div><div>No, you can&#39;t. The iter=
ator `erase` is a part of the sequence container requirements, and `basic_s=
tring` is a sequence container. Therefore, it <i>must</i> have such a funct=
ion.<br></div><div><br></div><div>`substr` is <i>not</i> a part of the cont=
ainer requirements. So it&#39;s dealer&#39;s choice.<br></div><div><br></di=
v><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>And you alr=
eady showed how this can be done.</div><div><br></div><div>However we are c=
omfortable with the member function=C2=A0</div><div><br><div style=3D"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#=
000">iterator erase</span><span style=3D"color:#660">(</span><span style=3D=
"color:#000">const_iterator first</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> const_iterator </span><span style=3D"color:#008=
">last</span><span style=3D"color:#660">);</span></div></code></div><span s=
tyle=3D"font-family:monospace;background-color:rgb(250,250,250);color:rgb(1=
02,102,0)"><br></span>because usually the iterators are obtained by applyin=
g standard algorithms to objects of the class std::basic_string.</div><div>=
<br></div><div>In fact it can be considered as a Standard defect because th=
e same requirements exists for the member function substr.</div></div></blo=
ckquote><div><br></div><div>No, it&#39;s not a defect. A defect is not an i=
nconsistency; it&#39;s <i>brokenness</i>. Being inconsistent is not being b=
roken.</div><br></div></blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-=
4c10-b211-01b01ddb817a%40isocpp.org</a>.<br>
</blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAPCFJdQnpHh_ra-YrKNASZkb2RY6_2n8_GkL=
iQOeTMPmxXpj6A%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdQnpHh_ra-Y=
rKNASZkb2RY6_2n8_GkLiQOeTMPmxXpj6A%40mail.gmail.com</a>.<br />

--000000000000fdcdbd056d095ffb--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Sat, 26 May 2018 07:20:56 -0700 (PDT)
Raw View
------=_Part_19903_1590252065.1527344456226
Content-Type: multipart/alternative;
 boundary="----=_Part_19904_1358069717.1527344456227"

------=_Part_19904_1358069717.1527344456227
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I have not understood what you mean.

=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 18:25:18 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> There *is* a reason: what you want doesn't need to access the string=20
> object itself. erase does.
>
> On Fri, May 25, 2018 at 5:11 PM 'Vlad from Moscow' via ISO C++ Standard -=
=20
> Future Proposals <std-pr...@isocpp.org <javascript:>> wrote:
>
>> I agrree that the member function substr is a specific member function o=
f=20
>> the class std::basic_string. Nevertheless the same approach should be us=
ed=20
>> as for the member function erase. There is no reason to separate approac=
hes=20
>> to these functions and isolate the function substr.
>>
>> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
>>
>>>
>>>
>>> On Friday, May 25, 2018 at 10:45:43 AM UTC-4, Vlad from Moscow wrote:
>>>>
>>>> According to your approach we could exclude the member function
>>>>
>>>> iterator erase(const_iterator first, const_iterator last);
>>>>
>>>> from the C++ Standard because it can be substituted for the member=20
>>>> function
>>>>
>>>> basic_string& erase(size_type pos =3D 0, size_type n =3D npos);
>>>>
>>>>
>>> No, you can't. The iterator `erase` is a part of the sequence container=
=20
>>> requirements, and `basic_string` is a sequence container. Therefore, it=
=20
>>> *must* have such a function.
>>>
>>> `substr` is *not* a part of the container requirements. So it's=20
>>> dealer's choice.
>>>
>>> And you already showed how this can be done.
>>>>
>>>> However we are comfortable with the member function=20
>>>>
>>>> iterator erase(const_iterator first, const_iterator last);
>>>>
>>>> because usually the iterators are obtained by applying standard=20
>>>> algorithms to objects of the class std::basic_string.
>>>>
>>>> In fact it can be considered as a Standard defect because the same=20
>>>> requirements exists for the member function substr.
>>>>
>>>
>>> No, it's not a defect. A defect is not an inconsistency; it's=20
>>> *brokenness*. Being inconsistent is not being broken.
>>>
>>> --=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit=20
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0c=
e3-4c10-b211-01b01ddb817a%40isocpp.org=20
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0=
ce3-4c10-b211-01b01ddb817a%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoo=
ter>
>> .
>>
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/3ef432b1-f9b7-4c25-870c-2de478fde263%40isocpp.or=
g.

------=_Part_19904_1358069717.1527344456227
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I have not understood what you mean.<br><br>=D0=BF=D1=8F=
=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 18:25:1=
8 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=
=D1=8C Micha=C5=82 Dominiak =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">There <i>is</i>=
=C2=A0a reason: what you want doesn&#39;t need to access the string object =
itself. erase does.</div><br><div class=3D"gmail_quote"><div dir=3D"ltr">On=
 Fri, May 25, 2018 at 5:11 PM &#39;Vlad from Moscow&#39; via ISO C++ Standa=
rd - Future Proposals &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obf=
uscated-mailto=3D"DBJmK8-lBQAJ" rel=3D"nofollow" onmousedown=3D"this.href=
=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascri=
pt:&#39;;return true;">std-pr...@isocpp.org</a>&gt; wrote:<br></div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr">I agrree that the member function =
substr is a specific member function of the class std::basic_string. Nevert=
heless the same approach should be used as for the member function erase. T=
here is no reason to separate approaches to these functions and isolate the=
 function substr.<br><br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=
=BC=D0=B0=D1=8F 2018 =D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=
=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=
=D0=B8=D1=81=D0=B0=D0=BB:</div><div dir=3D"ltr"><blockquote class=3D"gmail_=
quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;paddi=
ng-left:1ex"><div dir=3D"ltr"><br><br>On Friday, May 25, 2018 at 10:45:43 A=
M UTC-4, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"=
margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><di=
v dir=3D"ltr">According to your approach we could exclude the member functi=
on<div><br></div><div><div style=3D"background-color:rgb(250,250,250);borde=
r-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:brea=
k-word"><code><div><span style=3D"color:#000">iterator erase</span><span st=
yle=3D"color:#660">(</span><span style=3D"color:#000">const_iterator first<=
/span><span style=3D"color:#660">,</span><span style=3D"color:#000"> const_=
iterator </span><span style=3D"color:#008">last</span><span style=3D"color:=
#660">);</span></div></code></div><br>from the C++ Standard because it can =
be substituted for the member function</div><div><br></div><div><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#000">basic_string</span><span style=3D"color:#660">&amp;</span><=
span style=3D"color:#000"> erase</span><span style=3D"color:#660">(</span><=
span style=3D"color:#000">size_type pos </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">0</=
span><span style=3D"color:#660">,</span><span style=3D"color:#000"> size_ty=
pe n </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"=
> npos</span><span style=3D"color:#660">);</span></div></code></div><br></d=
iv></div></blockquote><div><br></div><div>No, you can&#39;t. The iterator `=
erase` is a part of the sequence container requirements, and `basic_string`=
 is a sequence container. Therefore, it <i>must</i> have such a function.<b=
r></div><div><br></div><div>`substr` is <i>not</i> a part of the container =
requirements. So it&#39;s dealer&#39;s choice.<br></div><div><br></div><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>And you already s=
howed how this can be done.</div><div><br></div><div>However we are comfort=
able with the member function=C2=A0</div><div><br><div style=3D"background-=
color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bor=
der-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">i=
terator erase</span><span style=3D"color:#660">(</span><span style=3D"color=
:#000">const_iterator first</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> const_iterator </span><span style=3D"color:#008">last=
</span><span style=3D"color:#660">);</span></div></code></div><span style=
=3D"font-family:monospace;background-color:rgb(250,250,250);color:rgb(102,1=
02,0)"><br></span>because usually the iterators are obtained by applying st=
andard algorithms to objects of the class std::basic_string.</div><div><br>=
</div><div>In fact it can be considered as a Standard defect because the sa=
me requirements exists for the member function substr.</div></div></blockqu=
ote><div><br></div><div>No, it&#39;s not a defect. A defect is not an incon=
sistency; it&#39;s <i>brokenness</i>. Being inconsistent is not being broke=
n.</div><br></div></blockquote></div>

<p></p>

-- <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 <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
DBJmK8-lBQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"DBJmK8-lBQAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/5bfb85ac-0ce3-4c10-<wbr>b211-=
01b01ddb817a%40isocpp.org</a><wbr>.<br>
</blockquote></div>
</blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3ef432b1-f9b7-4c25-870c-2de478fde263%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3ef432b1-f9b7-4c25-870c-2de478fde263=
%40isocpp.org</a>.<br />

------=_Part_19904_1358069717.1527344456227--

------=_Part_19903_1590252065.1527344456226--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sat, 26 May 2018 08:41:55 -0700 (PDT)
Raw View
------=_Part_20385_108299864.1527349315174
Content-Type: multipart/alternative;
 boundary="----=_Part_20386_1561203049.1527349315175"

------=_Part_20386_1561203049.1527349315175
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Saturday, May 26, 2018 at 10:20:56 AM UTC-4, Vlad from Moscow wrote:
>
> I have not understood what you mean.
>

I think his point is that `erase` is something you *cannot* do from outside=
=20
of the type itself. If `erase` didn't exist, you wouldn't be able to remove=
=20
characters from the string at all, except at the ends with=20
`pop_front/back`. As such, it is an indispensable tool for manipulating a=
=20
sequence of characters.

By contrast, `substr` exists purely for convenience. You can get the exact=
=20
same effect of `substr` by using existing `basic_string` constructors.

Without `erase`, `basic_string` is functionally deficient. Without=20
`substr`, it is less convenient to use... slightly.

The idea with `basic_string`'s convenience functions is that they exist for=
=20
people who use position/counts instead of iterators. They are consistent=20
with each other, and not with the iterator-based interfaces. `substr` is *n=
ot=20
supposed to be* consistent with `erase`. And if you added an iterator-based=
=20
overload for `substr`, why not for the rest of `basic_string`'s functions?

We keep coming back to the point that you can do exactly what you want *rig=
ht=20
now*; you just can't use the `substr` to do it.

=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 18:25:18 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak=20
> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>
>> There *is* a reason: what you want doesn't need to access the string=20
>> object itself. erase does.
>>
>> On Fri, May 25, 2018 at 5:11 PM 'Vlad from Moscow' via ISO C++ Standard =
-=20
>> Future Proposals <std-pr...@isocpp.org> wrote:
>>
>>> I agrree that the member function substr is a specific member function=
=20
>>> of the class std::basic_string. Nevertheless the same approach should b=
e=20
>>> used as for the member function erase. There is no reason to separate=
=20
>>> approaches to these functions and isolate the function substr.
>>>
>>> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
>>>
>>>>
>>>>
>>>> On Friday, May 25, 2018 at 10:45:43 AM UTC-4, Vlad from Moscow wrote:
>>>>>
>>>>> According to your approach we could exclude the member function
>>>>>
>>>>> iterator erase(const_iterator first, const_iterator last);
>>>>>
>>>>> from the C++ Standard because it can be substituted for the member=20
>>>>> function
>>>>>
>>>>> basic_string& erase(size_type pos =3D 0, size_type n =3D npos);
>>>>>
>>>>>
>>>> No, you can't. The iterator `erase` is a part of the sequence containe=
r=20
>>>> requirements, and `basic_string` is a sequence container. Therefore, i=
t=20
>>>> *must* have such a function.
>>>>
>>>> `substr` is *not* a part of the container requirements. So it's=20
>>>> dealer's choice.
>>>>
>>>> And you already showed how this can be done.
>>>>>
>>>>> However we are comfortable with the member function=20
>>>>>
>>>>> iterator erase(const_iterator first, const_iterator last);
>>>>>
>>>>> because usually the iterators are obtained by applying standard=20
>>>>> algorithms to objects of the class std::basic_string.
>>>>>
>>>>> In fact it can be considered as a Standard defect because the same=20
>>>>> requirements exists for the member function substr.
>>>>>
>>>>
>>>> No, it's not a defect. A defect is not an inconsistency; it's=20
>>>> *brokenness*. Being inconsistent is not being broken.
>>>>
>>>> --=20
>>> You received this message because you are subscribed to the Google=20
>>> Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>> an email to std-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> To view this discussion on the web visit=20
>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0=
ce3-4c10-b211-01b01ddb817a%40isocpp.org=20
>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-=
0ce3-4c10-b211-01b01ddb817a%40isocpp.org?utm_medium=3Demail&utm_source=3Dfo=
oter>
>>> .
>>>
>>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/e99d0234-9654-4908-b863-2ca59bfcad33%40isocpp.or=
g.

------=_Part_20386_1561203049.1527349315175
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Saturday, May 26, 2018 at 10:20:56 AM UTC-4, Vlad from =
Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
I have not understood what you mean.<br></div></blockquote><div><br></div><=
div>I think his point is that `erase` is something you <i>cannot</i> do fro=
m outside of the type itself. If `erase` didn&#39;t exist, you wouldn&#39;t=
 be able to remove characters from the string at all, except at the ends wi=
th `pop_front/back`. As such, it is an indispensable tool for manipulating =
a sequence of characters.</div><div><br></div><div>By contrast, `substr` ex=
ists purely for convenience. You can get the exact same effect of `substr` =
by using existing `basic_string` constructors.</div><div><br></div><div>Wit=
hout `erase`, `basic_string` is functionally deficient. Without `substr`, i=
t is less convenient to use... slightly.<br></div><div><br></div><div><div>=
The idea with `basic_string`&#39;s convenience functions is that they=20
exist for people who use position/counts instead of iterators. They are con=
sistent with each other, and not with the iterator-based interfaces. `subst=
r` is <i>not supposed to be</i> consistent with `erase`. And if you added a=
n iterator-based overload for `substr`, why not for the rest of `basic_stri=
ng`&#39;s functions?<br></div><div></div><div><br></div>We keep coming back=
 to the point that you can do exactly what you want <i>right now</i>; you j=
ust can&#39;t use the `substr` to do it.<br></div><br><blockquote class=3D"=
gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc so=
lid;padding-left: 1ex;"><div dir=3D"ltr">=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=
=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 18:25:18 UTC+3 =D0=BF=D0=BE=
=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Micha=C5=82 Do=
miniak =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmai=
l_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr">There <i>is</i>=C2=A0a reason: what you wan=
t doesn&#39;t need to access the string object itself. erase does.</div><br=
><div class=3D"gmail_quote"><div dir=3D"ltr">On Fri, May 25, 2018 at 5:11 P=
M &#39;Vlad from Moscow&#39; via ISO C++ Standard - Future Proposals &lt;<a=
 rel=3D"nofollow">std-pr...@isocpp.org</a>&gt; wrote:<br></div><blockquote =
class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid=
;padding-left:1ex"><div dir=3D"ltr">I agrree that the member function subst=
r is a specific member function of the class std::basic_string. Nevertheles=
s the same approach should be used as for the member function erase. There =
is no reason to separate approaches to these functions and isolate the func=
tion substr.<br><br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=
=D0=B0=D1=8F 2018 =D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=
=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=
=B8=D1=81=D0=B0=D0=BB:</div><div dir=3D"ltr"><blockquote class=3D"gmail_quo=
te" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-=
left:1ex"><div dir=3D"ltr"><br><br>On Friday, May 25, 2018 at 10:45:43 AM U=
TC-4, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"mar=
gin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div d=
ir=3D"ltr">According to your approach we could exclude the member function<=
div><br></div><div><div style=3D"background-color:rgb(250,250,250);border-c=
olor:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-w=
ord"><code><div><span style=3D"color:#000">iterator erase</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">const_iterator first</sp=
an><span style=3D"color:#660">,</span><span style=3D"color:#000"> const_ite=
rator </span><span style=3D"color:#008">last</span><span style=3D"color:#66=
0">);</span></div></code></div><br>from the C++ Standard because it can be =
substituted for the member function</div><div><br></div><div><div style=3D"=
background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-styl=
e:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"co=
lor:#000">basic_string</span><span style=3D"color:#660">&amp;</span><span s=
tyle=3D"color:#000"> erase</span><span style=3D"color:#660">(</span><span s=
tyle=3D"color:#000">size_type pos </span><span style=3D"color:#660">=3D</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#066">0</span><s=
pan style=3D"color:#660">,</span><span style=3D"color:#000"> size_type n </=
span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> npos<=
/span><span style=3D"color:#660">);</span></div></code></div><br></div></di=
v></blockquote><div><br></div><div>No, you can&#39;t. The iterator `erase` =
is a part of the sequence container requirements, and `basic_string` is a s=
equence container. Therefore, it <i>must</i> have such a function.<br></div=
><div><br></div><div>`substr` is <i>not</i> a part of the container require=
ments. So it&#39;s dealer&#39;s choice.<br></div><div><br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px =
#ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>And you already showed h=
ow this can be done.</div><div><br></div><div>However we are comfortable wi=
th the member function=C2=A0</div><div><br><div style=3D"background-color:r=
gb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wid=
th:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">iterator=
 erase</span><span style=3D"color:#660">(</span><span style=3D"color:#000">=
const_iterator first</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> const_iterator </span><span style=3D"color:#008">last</spa=
n><span style=3D"color:#660">);</span></div></code></div><span style=3D"fon=
t-family:monospace;background-color:rgb(250,250,250);color:rgb(102,102,0)">=
<br></span>because usually the iterators are obtained by applying standard =
algorithms to objects of the class std::basic_string.</div><div><br></div><=
div>In fact it can be considered as a Standard defect because the same requ=
irements exists for the member function substr.</div></div></blockquote><di=
v><br></div><div>No, it&#39;s not a defect. A defect is not an inconsistenc=
y; it&#39;s <i>brokenness</i>. Being inconsistent is not being broken.</div=
><br></div></blockquote></div>

<p></p>

-- <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 <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/5bfb85ac-0ce3-4c10-<wbr>b211-=
01b01ddb817a%40isocpp.org</a><wbr>.<br>
</blockquote></div>
</blockquote></div></blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e99d0234-9654-4908-b863-2ca59bfcad33%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e99d0234-9654-4908-b863-2ca59bfcad33=
%40isocpp.org</a>.<br />

------=_Part_20386_1561203049.1527349315175--

------=_Part_20385_108299864.1527349315174--

.


Author: =?UTF-8?B?R2HFoXBlciBBxb5tYW4=?= <gasper.azman@gmail.com>
Date: Sat, 26 May 2018 19:01:25 +0100
Raw View
--000000000000d4af58056d1fac9e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I keep thinking of Sean Parent's talk about every type having to offer the
efficient basis of operations on it.

Convenience after that is just convenience and is secondary.

The consideration here, if I exaggerate a bit, is that string has ventured
so far into the convenience space at this point that it's practically a
dsl. The question is not whether the iterator version of substr belongs in
the API - it does - but whether actually putting that into the standard is
enough of a priority to actually get done.

I'm leaning towards no personally, just because it's not enough of an itch
for me to argue for it getting on the agenda.

Other people who care can make a paper and get it scheduled, if they care
enough.

G

On Sat, May 26, 2018, 16:41 Nicol Bolas <jmckesson@gmail.com> wrote:

> On Saturday, May 26, 2018 at 10:20:56 AM UTC-4, Vlad from Moscow wrote:
>>
>> I have not understood what you mean.
>>
>
> I think his point is that `erase` is something you *cannot* do from
> outside of the type itself. If `erase` didn't exist, you wouldn't be able
> to remove characters from the string at all, except at the ends with
> `pop_front/back`. As such, it is an indispensable tool for manipulating a
> sequence of characters.
>
> By contrast, `substr` exists purely for convenience. You can get the exac=
t
> same effect of `substr` by using existing `basic_string` constructors.
>
> Without `erase`, `basic_string` is functionally deficient. Without
> `substr`, it is less convenient to use... slightly.
>
> The idea with `basic_string`'s convenience functions is that they exist
> for people who use position/counts instead of iterators. They are
> consistent with each other, and not with the iterator-based interfaces.
> `substr` is *not supposed to be* consistent with `erase`. And if you
> added an iterator-based overload for `substr`, why not for the rest of
> `basic_string`'s functions?
>
> We keep coming back to the point that you can do exactly what you want *r=
ight
> now*; you just can't use the `substr` to do it.
>
> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 18:25:18 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak
>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>
>>> There *is* a reason: what you want doesn't need to access the string
>>> object itself. erase does.
>>>
>>> On Fri, May 25, 2018 at 5:11 PM 'Vlad from Moscow' via ISO C++ Standard
>>> - Future Proposals <std-pr...@isocpp.org> wrote:
>>>
>>>> I agrree that the member function substr is a specific member function
>>>> of the class std::basic_string. Nevertheless the same approach should =
be
>>>> used as for the member function erase. There is no reason to separate
>>>> approaches to these functions and isolate the function substr.
>>>>
>>>> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018=
 =D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=
=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas
>>>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>>
>>>>>
>>>>>
>>>>> On Friday, May 25, 2018 at 10:45:43 AM UTC-4, Vlad from Moscow wrote:
>>>>>>
>>>>>> According to your approach we could exclude the member function
>>>>>>
>>>>>> iterator erase(const_iterator first, const_iterator last);
>>>>>>
>>>>>> from the C++ Standard because it can be substituted for the member
>>>>>> function
>>>>>>
>>>>>> basic_string& erase(size_type pos =3D 0, size_type n =3D npos);
>>>>>>
>>>>>>
>>>>> No, you can't. The iterator `erase` is a part of the sequence
>>>>> container requirements, and `basic_string` is a sequence container.
>>>>> Therefore, it *must* have such a function.
>>>>>
>>>>> `substr` is *not* a part of the container requirements. So it's
>>>>> dealer's choice.
>>>>>
>>>>> And you already showed how this can be done.
>>>>>>
>>>>>> However we are comfortable with the member function
>>>>>>
>>>>>> iterator erase(const_iterator first, const_iterator last);
>>>>>>
>>>>>> because usually the iterators are obtained by applying standard
>>>>>> algorithms to objects of the class std::basic_string.
>>>>>>
>>>>>> In fact it can be considered as a Standard defect because the same
>>>>>> requirements exists for the member function substr.
>>>>>>
>>>>>
>>>>> No, it's not a defect. A defect is not an inconsistency; it's
>>>>> *brokenness*. Being inconsistent is not being broken.
>>>>>
>>>>> --
>>>> 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-proposal...@isocpp.org.
>>>> To post to this group, send email to std-pr...@isocpp.org.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-=
0ce3-4c10-b211-01b01ddb817a%40isocpp.org
>>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac=
-0ce3-4c10-b211-01b01ddb817a%40isocpp.org?utm_medium=3Demail&utm_source=3Df=
ooter>
>>>> .
>>>>
>>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e99d0234-965=
4-4908-b863-2ca59bfcad33%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e99d0234-96=
54-4908-b863-2ca59bfcad33%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAANG%3DkWg%3DTwt7R6roLCoSE_fdUnvshhj4CbxdmbHq1X=
C3sMcJQ%40mail.gmail.com.

--000000000000d4af58056d1fac9e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">I keep thinking of Sean Parent&#39;s talk about every typ=
e having to offer the efficient basis of operations on it.<div dir=3D"auto"=
><br></div><div dir=3D"auto">Convenience after that is just convenience and=
 is secondary.</div><div dir=3D"auto"><br></div><div dir=3D"auto">The consi=
deration here, if I exaggerate a bit, is that string has ventured so far in=
to the convenience space at this point that it&#39;s practically a dsl. The=
 question is not whether the iterator version of substr belongs in the API =
- it does - but whether actually putting that into the standard is enough o=
f a priority to actually get done.</div><div dir=3D"auto"><br></div><div di=
r=3D"auto">I&#39;m leaning towards no personally, just because it&#39;s not=
 enough of an itch for me to argue for it getting on the agenda.</div><div =
dir=3D"auto"><br></div><div dir=3D"auto">Other people who care can make a p=
aper and get it scheduled, if they care enough.</div><div dir=3D"auto"><br>=
</div><div dir=3D"auto">G</div></div><br><div class=3D"gmail_quote"><div di=
r=3D"ltr">On Sat, May 26, 2018, 16:41 Nicol Bolas &lt;<a href=3D"mailto:jmc=
kesson@gmail.com">jmckesson@gmail.com</a>&gt; wrote:<br></div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;=
padding-left:1ex"><div dir=3D"ltr">On Saturday, May 26, 2018 at 10:20:56 AM=
 UTC-4, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"m=
argin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div=
 dir=3D"ltr">I have not understood what you mean.<br></div></blockquote><di=
v><br></div><div>I think his point is that `erase` is something you <i>cann=
ot</i> do from outside of the type itself. If `erase` didn&#39;t exist, you=
 wouldn&#39;t be able to remove characters from the string at all, except a=
t the ends with `pop_front/back`. As such, it is an indispensable tool for =
manipulating a sequence of characters.</div><div><br></div><div>By contrast=
, `substr` exists purely for convenience. You can get the exact same effect=
 of `substr` by using existing `basic_string` constructors.</div><div><br><=
/div><div>Without `erase`, `basic_string` is functionally deficient. Withou=
t `substr`, it is less convenient to use... slightly.<br></div><div><br></d=
iv><div><div>The idea with `basic_string`&#39;s convenience functions is th=
at they=20
exist for people who use position/counts instead of iterators. They are con=
sistent with each other, and not with the iterator-based interfaces. `subst=
r` is <i>not supposed to be</i> consistent with `erase`. And if you added a=
n iterator-based overload for `substr`, why not for the rest of `basic_stri=
ng`&#39;s functions?<br></div><div></div><div><br></div>We keep coming back=
 to the point that you can do exactly what you want <i>right now</i>; you j=
ust can&#39;t use the `substr` to do it.<br></div><br><blockquote class=3D"=
gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid=
;padding-left:1ex"><div dir=3D"ltr">=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=
=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 18:25:18 UTC+3 =D0=BF=D0=BE=D0=BB=
=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak=
 =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quot=
e" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr">There <i>is</i>=C2=A0a reason: what you want does=
n&#39;t need to access the string object itself. erase does.</div><br><div =
class=3D"gmail_quote"><div dir=3D"ltr">On Fri, May 25, 2018 at 5:11 PM &#39=
;Vlad from Moscow&#39; via ISO C++ Standard - Future Proposals &lt;<a rel=
=3D"nofollow noreferrer">std-pr...@isocpp.org</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr">I agrree that the member functio=
n substr is a specific member function of the class std::basic_string. Neve=
rtheless the same approach should be used as for the member function erase.=
 There is no reason to separate approaches to these functions and isolate t=
he function substr.<br><br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =
=D0=BC=D0=B0=D1=8F 2018 =D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=
=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=
=BF=D0=B8=D1=81=D0=B0=D0=BB:</div><div dir=3D"ltr"><blockquote class=3D"gma=
il_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div dir=3D"ltr"><br><br>On Friday, May 25, 2018 at 10:45:4=
3 AM UTC-4, Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr">According to your approach we could exclude the member fu=
nction<div><br></div><div><div style=3D"background-color:rgb(250,250,250);b=
order-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:=
break-word"><code><div><span style=3D"color:#000">iterator erase</span><spa=
n style=3D"color:#660">(</span><span style=3D"color:#000">const_iterator fi=
rst</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> co=
nst_iterator </span><span style=3D"color:#008">last</span><span style=3D"co=
lor:#660">);</span></div></code></div><br>from the C++ Standard because it =
can be substituted for the member function</div><div><br></div><div><div st=
yle=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bord=
er-style:solid;border-width:1px;word-wrap:break-word"><code><div><span styl=
e=3D"color:#000">basic_string</span><span style=3D"color:#660">&amp;</span>=
<span style=3D"color:#000"> erase</span><span style=3D"color:#660">(</span>=
<span style=3D"color:#000">size_type pos </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">0</=
span><span style=3D"color:#660">,</span><span style=3D"color:#000"> size_ty=
pe n </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"=
> npos</span><span style=3D"color:#660">);</span></div></code></div><br></d=
iv></div></blockquote><div><br></div><div>No, you can&#39;t. The iterator `=
erase` is a part of the sequence container requirements, and `basic_string`=
 is a sequence container. Therefore, it <i>must</i> have such a function.<b=
r></div><div><br></div><div>`substr` is <i>not</i> a part of the container =
requirements. So it&#39;s dealer&#39;s choice.<br></div><div><br></div><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>And you already s=
howed how this can be done.</div><div><br></div><div>However we are comfort=
able with the member function=C2=A0</div><div><br><div style=3D"background-=
color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bor=
der-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">i=
terator erase</span><span style=3D"color:#660">(</span><span style=3D"color=
:#000">const_iterator first</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> const_iterator </span><span style=3D"color:#008">last=
</span><span style=3D"color:#660">);</span></div></code></div><span style=
=3D"font-family:monospace;background-color:rgb(250,250,250);color:rgb(102,1=
02,0)"><br></span>because usually the iterators are obtained by applying st=
andard algorithms to objects of the class std::basic_string.</div><div><br>=
</div><div>In fact it can be considered as a Standard defect because the sa=
me requirements exists for the member function substr.</div></div></blockqu=
ote><div><br></div><div>No, it&#39;s not a defect. A defect is not an incon=
sistency; it&#39;s <i>brokenness</i>. Being inconsistent is not being broke=
n.</div><br></div></blockquote></div>

<p></p>

-- <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 <a rel=3D"nofollow noreferrer">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow noreferrer">std-pr.=
...@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"nofollow no=
referrer" target=3D"_blank">https://groups.google.com/a/isocpp.org/d/msgid/=
std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%40isocpp.org</a>.<br>
</blockquote></div>
</blockquote></div></blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank" rel=3D"noreferrer">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank" rel=3D"noreferrer">std-proposals@isocpp.org</a>.<br=
>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e99d0234-9654-4908-b863-2ca59bfcad33%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"noreferrer">https://groups.google.com/a/isocpp.org/d/msgid/std-propo=
sals/e99d0234-9654-4908-b863-2ca59bfcad33%40isocpp.org</a>.<br>
</blockquote></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkWg%3DTwt7R6roLCoSE_fdUnvshhj=
4CbxdmbHq1XC3sMcJQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkWg%3=
DTwt7R6roLCoSE_fdUnvshhj4CbxdmbHq1XC3sMcJQ%40mail.gmail.com</a>.<br />

--000000000000d4af58056d1fac9e--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sat, 26 May 2018 13:10:41 -0700 (PDT)
Raw View
------=_Part_21659_132225534.1527365441767
Content-Type: multipart/alternative;
 boundary="----=_Part_21660_1214737595.1527365441767"

------=_Part_21660_1214737595.1527365441767
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



On Saturday, May 26, 2018 at 2:01:37 PM UTC-4, Ga=C5=A1per A=C5=BEman wrote=
:
>
> I keep thinking of Sean Parent's talk about every type having to offer th=
e=20
> efficient basis of operations on it.
>
> Convenience after that is just convenience and is secondary.
>
> The consideration here, if I exaggerate a bit, is that string has venture=
d=20
> so far into the convenience space at this point that it's practically a d=
sl.
>

I wouldn't go far enough to call it a domain-specific language. There have=
=20
been times when I really wanted to use `vector` with pos/n ranges too.=20
These are usually times when I'm interfacing with C-like APIs and such, so=
=20
I'm having to convert between C-style interfaces that use pos/n and=20
`vector`/algorithms' iterator-based interface.

It'd be great if the Range TS could give us some tools for applying a pos/n=
=20
pair to a random-access range to generate a new range, and conversely=20
converting a random-access range to pos/n. This would allow us to work with=
=20
which we want and convert as needed, without having to add a bunch of extra=
=20
interfaces.

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/4e554cd5-f4a5-4732-9b34-911a73810cd0%40isocpp.or=
g.

------=_Part_21660_1214737595.1527365441767
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Saturday, May 26, 2018 at 2:01:37 PM UTC-4, Ga=
=C5=A1per A=C5=BEman wrote:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"auto">I keep thinking of Sean Parent&#39;s talk about every type h=
aving to offer the efficient basis of operations on it.<div dir=3D"auto"><b=
r></div><div dir=3D"auto">Convenience after that is just convenience and is=
 secondary.</div><div dir=3D"auto"><br></div><div dir=3D"auto">The consider=
ation here, if I exaggerate a bit, is that string has ventured so far into =
the convenience space at this point that it&#39;s practically a dsl.</div><=
/div></blockquote><div><br></div><div>I wouldn&#39;t go far enough to call =
it a domain-specific language. There have been times when I really wanted t=
o use `vector` with pos/n ranges too. These are usually times when I&#39;m =
interfacing with C-like APIs and such, so I&#39;m having to convert between=
 C-style interfaces that use pos/n and `vector`/algorithms&#39; iterator-ba=
sed interface.</div><div><br></div><div></div><div>It&#39;d be great if the=
 Range TS could give us some tools for applying a pos/n pair to a random-ac=
cess range to generate a new range, and conversely converting a random-acce=
ss range to pos/n. This would allow us to work with which we want and conve=
rt as needed, without having to add a bunch of extra interfaces.</div></div=
>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4e554cd5-f4a5-4732-9b34-911a73810cd0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/4e554cd5-f4a5-4732-9b34-911a73810cd0=
%40isocpp.org</a>.<br />

------=_Part_21660_1214737595.1527365441767--

------=_Part_21659_132225534.1527365441767--

.


Author: =?UTF-8?B?R2HFoXBlciBBxb5tYW4=?= <gasper.azman@gmail.com>
Date: Sat, 26 May 2018 21:16:33 +0100
Raw View
--000000000000c3df75056d2190b6
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hear hear.

On Sat, May 26, 2018 at 9:10 PM, Nicol Bolas <jmckesson@gmail.com> wrote:

>
>
> On Saturday, May 26, 2018 at 2:01:37 PM UTC-4, Ga=C5=A1per A=C5=BEman wro=
te:
>>
>> I keep thinking of Sean Parent's talk about every type having to offer
>> the efficient basis of operations on it.
>>
>> Convenience after that is just convenience and is secondary.
>>
>> The consideration here, if I exaggerate a bit, is that string has
>> ventured so far into the convenience space at this point that it's
>> practically a dsl.
>>
>
> I wouldn't go far enough to call it a domain-specific language. There hav=
e
> been times when I really wanted to use `vector` with pos/n ranges too.
> These are usually times when I'm interfacing with C-like APIs and such, s=
o
> I'm having to convert between C-style interfaces that use pos/n and
> `vector`/algorithms' iterator-based interface.
>
> It'd be great if the Range TS could give us some tools for applying a
> pos/n pair to a random-access range to generate a new range, and converse=
ly
> converting a random-access range to pos/n. This would allow us to work wi=
th
> which we want and convert as needed, without having to add a bunch of ext=
ra
> interfaces.
>
> --
> 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.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/4e554cd5-f4a5-4732-
> 9b34-911a73810cd0%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/4e554cd5-f4=
a5-4732-9b34-911a73810cd0%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CAANG%3DkU9VdoEerY1O9eww-Yy0p3Y69%2BpXVP93dbZXsA=
VT9xYBQ%40mail.gmail.com.

--000000000000c3df75056d2190b6
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hear hear.</div><div class=3D"gmail_extra"><br><div class=
=3D"gmail_quote">On Sat, May 26, 2018 at 9:10 PM, Nicol Bolas <span dir=3D"=
ltr">&lt;<a href=3D"mailto:jmckesson@gmail.com" target=3D"_blank">jmckesson=
@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><span class=3D""><br><br>On Saturday, May 26, 2018 at 2:01:37 PM U=
TC-4, Ga=C5=A1per A=C5=BEman wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"auto">I keep thinking of Sean Parent&#39;s talk about every ty=
pe having to offer the efficient basis of operations on it.<div dir=3D"auto=
"><br></div><div dir=3D"auto">Convenience after that is just convenience an=
d is secondary.</div><div dir=3D"auto"><br></div><div dir=3D"auto">The cons=
ideration here, if I exaggerate a bit, is that string has ventured so far i=
nto the convenience space at this point that it&#39;s practically a dsl.</d=
iv></div></blockquote><div><br></div></span><div>I wouldn&#39;t go far enou=
gh to call it a domain-specific language. There have been times when I real=
ly wanted to use `vector` with pos/n ranges too. These are usually times wh=
en I&#39;m interfacing with C-like APIs and such, so I&#39;m having to conv=
ert between C-style interfaces that use pos/n and `vector`/algorithms&#39; =
iterator-based interface.</div><div><br></div><div></div><div>It&#39;d be g=
reat if the Range TS could give us some tools for applying a pos/n pair to =
a random-access range to generate a new range, and conversely converting a =
random-access range to pos/n. This would allow us to work with which we wan=
t and convert as needed, without having to add a bunch of extra interfaces.=
</div></div><span class=3D"">

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/4e554cd5-f4a5-4732-9b34-911a73810cd0%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/4e55=
4cd5-f4a5-4732-<wbr>9b34-911a73810cd0%40isocpp.org</a><wbr>.<br>
</blockquote></div><br></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkU9VdoEerY1O9eww-Yy0p3Y69%2Bp=
XVP93dbZXsAVT9xYBQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAANG%3DkU9Vd=
oEerY1O9eww-Yy0p3Y69%2BpXVP93dbZXsAVT9xYBQ%40mail.gmail.com</a>.<br />

--000000000000c3df75056d2190b6--

.


Author: "'Vlad from Moscow' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Tue, 29 May 2018 08:22:06 -0700 (PDT)
Raw View
------=_Part_38579_264193147.1527607326192
Content-Type: multipart/alternative;
 boundary="----=_Part_38580_1573009167.1527607326192"

------=_Part_38580_1573009167.1527607326192
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It is the interface that is important.

In fact the member function *substr *is a constructor that is based on the=
=20
current object of the type *std::basic_string*.

The corresponding actual constructors are

basic_string(const basic_string& str, size_type pos, size_type n, const=20
Allocator& a =3D Allocator());

and

template <class InputIterator>
basic_string(InputIterator begin, InputIterator end,
const Allocator& a =3D Allocator());



So the member function *substr *should provide the same functionality.



=D1=81=D1=83=D0=B1=D0=B1=D0=BE=D1=82=D0=B0, 26 =D0=BC=D0=B0=D1=8F 2018 =D0=
=B3., 18:41:55 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=
=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> On Saturday, May 26, 2018 at 10:20:56 AM UTC-4, Vlad from Moscow wrote:
>>
>> I have not understood what you mean.
>>
>
> I think his point is that `erase` is something you *cannot* do from=20
> outside of the type itself. If `erase` didn't exist, you wouldn't be able=
=20
> to remove characters from the string at all, except at the ends with=20
> `pop_front/back`. As such, it is an indispensable tool for manipulating a=
=20
> sequence of characters.
>
> By contrast, `substr` exists purely for convenience. You can get the exac=
t=20
> same effect of `substr` by using existing `basic_string` constructors.
>
> Without `erase`, `basic_string` is functionally deficient. Without=20
> `substr`, it is less convenient to use... slightly.
>
> The idea with `basic_string`'s convenience functions is that they exist=
=20
> for people who use position/counts instead of iterators. They are=20
> consistent with each other, and not with the iterator-based interfaces.=
=20
> `substr` is *not supposed to be* consistent with `erase`. And if you=20
> added an iterator-based overload for `substr`, why not for the rest of=20
> `basic_string`'s functions?
>
> We keep coming back to the point that you can do exactly what you want *r=
ight=20
> now*; you just can't use the `substr` to do it.
>
> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =
=D0=B3., 18:25:18 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=
=82=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak=20
>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>
>>> There *is* a reason: what you want doesn't need to access the string=20
>>> object itself. erase does.
>>>
>>> On Fri, May 25, 2018 at 5:11 PM 'Vlad from Moscow' via ISO C++ Standard=
=20
>>> - Future Proposals <std-pr...@isocpp.org> wrote:
>>>
>>>> I agrree that the member function substr is a specific member function=
=20
>>>> of the class std::basic_string. Nevertheless the same approach should =
be=20
>>>> used as for the member function erase. There is no reason to separate=
=20
>>>> approaches to these functions and isolate the function substr.
>>>>
>>>> =D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=D1=8F 2018=
 =D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=
=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas=20
>>>> =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>>>>
>>>>>
>>>>>
>>>>> On Friday, May 25, 2018 at 10:45:43 AM UTC-4, Vlad from Moscow wrote:
>>>>>>
>>>>>> According to your approach we could exclude the member function
>>>>>>
>>>>>> iterator erase(const_iterator first, const_iterator last);
>>>>>>
>>>>>> from the C++ Standard because it can be substituted for the member=
=20
>>>>>> function
>>>>>>
>>>>>> basic_string& erase(size_type pos =3D 0, size_type n =3D npos);
>>>>>>
>>>>>>
>>>>> No, you can't. The iterator `erase` is a part of the sequence=20
>>>>> container requirements, and `basic_string` is a sequence container.=
=20
>>>>> Therefore, it *must* have such a function.
>>>>>
>>>>> `substr` is *not* a part of the container requirements. So it's=20
>>>>> dealer's choice.
>>>>>
>>>>> And you already showed how this can be done.
>>>>>>
>>>>>> However we are comfortable with the member function=20
>>>>>>
>>>>>> iterator erase(const_iterator first, const_iterator last);
>>>>>>
>>>>>> because usually the iterators are obtained by applying standard=20
>>>>>> algorithms to objects of the class std::basic_string.
>>>>>>
>>>>>> In fact it can be considered as a Standard defect because the same=
=20
>>>>>> requirements exists for the member function substr.
>>>>>>
>>>>>
>>>>> No, it's not a defect. A defect is not an inconsistency; it's=20
>>>>> *brokenness*. Being inconsistent is not being broken.
>>>>>
>>>>> --=20
>>>> You received this message because you are subscribed to the Google=20
>>>> Groups "ISO C++ Standard - Future Proposals" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send=
=20
>>>> an email to std-proposal...@isocpp.org.
>>>> To post to this group, send email to std-pr...@isocpp.org.
>>>> To view this discussion on the web visit=20
>>>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-=
0ce3-4c10-b211-01b01ddb817a%40isocpp.org=20
>>>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5bfb85ac=
-0ce3-4c10-b211-01b01ddb817a%40isocpp.org?utm_medium=3Demail&utm_source=3Df=
ooter>
>>>> .
>>>>
>>>

--=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/bf64457a-f738-457c-82ed-e9f088d17588%40isocpp.or=
g.

------=_Part_38580_1573009167.1527607326192
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It is the interface that is important.<div><br></div><div>=
In fact the member function <b>substr </b>is a constructor that is based on=
 the current object of the type <b>std::basic_string</b>.</div><div><br></d=
iv><div>The corresponding actual constructors are</div><div><br></div><div>=
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wo=
rd-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><span style=3D"color: #000;" class=3D"styled-by-prettify">basic_string=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">const</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> basic_string</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&amp;</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> str</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> size_type pos</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> size_type n</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>Allocator</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> a </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Allocator</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">());</span></div></code></di=
v><br>and</div><div><br></div><div class=3D"prettyprint" style=3D"backgroun=
d-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style=
: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettypr=
int"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">template</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #606;" class=3D"styled-by-prettify">InputIterator=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span=
><class inputiterator=3D""><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>basic_string</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">(</span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">InputIterator</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>begin</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #606;" class=3D"styled-by-prettify">InputIterator</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">end</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">const</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">Allocator</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> a </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #606;" class=3D"styled-by-prettify">Allocator</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">());</span></clas=
s><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></s=
pan></div></code></div><div><br></div><div>So the member function <b>substr=
 </b>should provide the same functionality.<br><br></div><div><br><br>=D1=
=81=D1=83=D0=B1=D0=B1=D0=BE=D1=82=D0=B0, 26 =D0=BC=D0=B0=D1=8F 2018 =D0=B3.=
, 18:41:55 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=
=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Saturday, May =
26, 2018 at 10:20:56 AM UTC-4, Vlad from Moscow wrote:<blockquote class=3D"=
gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid=
;padding-left:1ex"><div dir=3D"ltr">I have not understood what you mean.<br=
></div></blockquote><div><br></div><div>I think his point is that `erase` i=
s something you <i>cannot</i> do from outside of the type itself. If `erase=
` didn&#39;t exist, you wouldn&#39;t be able to remove characters from the =
string at all, except at the ends with `pop_front/back`. As such, it is an =
indispensable tool for manipulating a sequence of characters.</div><div><br=
></div><div>By contrast, `substr` exists purely for convenience. You can ge=
t the exact same effect of `substr` by using existing `basic_string` constr=
uctors.</div><div><br></div><div>Without `erase`, `basic_string` is functio=
nally deficient. Without `substr`, it is less convenient to use... slightly=
..<br></div><div><br></div><div><div>The idea with `basic_string`&#39;s conv=
enience functions is that they=20
exist for people who use position/counts instead of iterators. They are con=
sistent with each other, and not with the iterator-based interfaces. `subst=
r` is <i>not supposed to be</i> consistent with `erase`. And if you added a=
n iterator-based overload for `substr`, why not for the rest of `basic_stri=
ng`&#39;s functions?<br></div><div></div><div><br></div>We keep coming back=
 to the point that you can do exactly what you want <i>right now</i>; you j=
ust can&#39;t use the `substr` to do it.<br></div><br><blockquote class=3D"=
gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid=
;padding-left:1ex"><div dir=3D"ltr">=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=
=B0, 25 =D0=BC=D0=B0=D1=8F 2018 =D0=B3., 18:25:18 UTC+3 =D0=BF=D0=BE=D0=BB=
=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Micha=C5=82 Dominiak=
 =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quot=
e" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr">There <i>is</i>=C2=A0a reason: what you want does=
n&#39;t need to access the string object itself. erase does.</div><br><div =
class=3D"gmail_quote"><div dir=3D"ltr">On Fri, May 25, 2018 at 5:11 PM &#39=
;Vlad from Moscow&#39; via ISO C++ Standard - Future Proposals &lt;<a rel=
=3D"nofollow">std-pr...@isocpp.org</a>&gt; wrote:<br></div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr">I agrree that the member function substr is=
 a specific member function of the class std::basic_string. Nevertheless th=
e same approach should be used as for the member function erase. There is n=
o reason to separate approaches to these functions and isolate the function=
 substr.<br><br>=D0=BF=D1=8F=D1=82=D0=BD=D0=B8=D1=86=D0=B0, 25 =D0=BC=D0=B0=
=D1=8F 2018 =D0=B3., 18:00:19 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=
=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Nicol Bolas =D0=BD=D0=B0=D0=BF=D0=B8=D1=
=81=D0=B0=D0=BB:</div><div dir=3D"ltr"><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr"><br><br>On Friday, May 25, 2018 at 10:45:43 AM UTC-4, =
Vlad from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;=
margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"=
ltr">According to your approach we could exclude the member function<div><b=
r></div><div><div style=3D"background-color:rgb(250,250,250);border-color:r=
gb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><=
code><div><span style=3D"color:#000">iterator erase</span><span style=3D"co=
lor:#660">(</span><span style=3D"color:#000">const_iterator first</span><sp=
an style=3D"color:#660">,</span><span style=3D"color:#000"> const_iterator =
</span><span style=3D"color:#008">last</span><span style=3D"color:#660">);<=
/span></div></code></div><br>from the C++ Standard because it can be substi=
tuted for the member function</div><div><br></div><div><div style=3D"backgr=
ound-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:soli=
d;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#0=
00">basic_string</span><span style=3D"color:#660">&amp;</span><span style=
=3D"color:#000"> erase</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">size_type pos </span><span style=3D"color:#660">=3D</span><=
span style=3D"color:#000"> </span><span style=3D"color:#066">0</span><span =
style=3D"color:#660">,</span><span style=3D"color:#000"> size_type n </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> npos</spa=
n><span style=3D"color:#660">);</span></div></code></div><br></div></div></=
blockquote><div><br></div><div>No, you can&#39;t. The iterator `erase` is a=
 part of the sequence container requirements, and `basic_string` is a seque=
nce container. Therefore, it <i>must</i> have such a function.<br></div><di=
v><br></div><div>`substr` is <i>not</i> a part of the container requirement=
s. So it&#39;s dealer&#39;s choice.<br></div><div><br></div><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><div dir=3D"ltr"><div>And you already showed how t=
his can be done.</div><div><br></div><div>However we are comfortable with t=
he member function=C2=A0</div><div><br><div style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px;word-wrap:break-word"><code><div><span style=3D"color:#000">iterator era=
se</span><span style=3D"color:#660">(</span><span style=3D"color:#000">cons=
t_iterator first</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000"> const_iterator </span><span style=3D"color:#008">last</span><spa=
n style=3D"color:#660">);</span></div></code></div><span style=3D"font-fami=
ly:monospace;background-color:rgb(250,250,250);color:rgb(102,102,0)"><br></=
span>because usually the iterators are obtained by applying standard algori=
thms to objects of the class std::basic_string.</div><div><br></div><div>In=
 fact it can be considered as a Standard defect because the same requiremen=
ts exists for the member function substr.</div></div></blockquote><div><br>=
</div><div>No, it&#39;s not a defect. A defect is not an inconsistency; it&=
#39;s <i>brokenness</i>. Being inconsistent is not being broken.</div><br><=
/div></blockquote></div>

<p></p>

-- <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 <a rel=3D"nofollow">std-proposal...@isocpp.org</a>.<br>
To post to this group, send email to <a rel=3D"nofollow">std-pr...@isocpp.o=
rg</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" rel=3D"nofollow" t=
arget=3D"_blank" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/5bfb85ac-0ce3-4c10-b211-01b01ddb817a%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/5bfb85ac-0ce3-4c10-<wbr>b211-=
01b01ddb817a%40isocpp.org</a><wbr>.<br>
</blockquote></div>
</blockquote></div></blockquote></div></blockquote></div></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/bf64457a-f738-457c-82ed-e9f088d17588%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/bf64457a-f738-457c-82ed-e9f088d17588=
%40isocpp.org</a>.<br />

------=_Part_38580_1573009167.1527607326192--

------=_Part_38579_264193147.1527607326192--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 29 May 2018 08:47:12 -0700 (PDT)
Raw View
------=_Part_38556_453043783.1527608832804
Content-Type: multipart/alternative;
 boundary="----=_Part_38557_1413970261.1527608832804"

------=_Part_38557_1413970261.1527608832804
Content-Type: text/plain; charset="UTF-8"



On Tuesday, May 29, 2018 at 11:22:06 AM UTC-4, Vlad from Moscow wrote:
>
> It is the interface that is important.
>
> In fact the member function *substr *is a constructor that is based on
> the current object of the type *std::basic_string*.
>
> The corresponding actual constructors are
>
> basic_string(const basic_string& str, size_type pos, size_type n, const
> Allocator& a = Allocator());
>
> and
>
> template <class InputIterator>
> basic_string(InputIterator begin, InputIterator end,
> const Allocator& a = Allocator());
>
>
>
> So the member function *substr *should provide the same functionality.
>

Which is just as good an argument for saying that `substr` *shouldn't exist*.
If it is in fact "a constructor", then it is an entirely redundant
constructor. Especially with class template argument deduction.

Why add more redundancy?

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5b5620fb-643f-4574-b042-98e364ee0411%40isocpp.org.

------=_Part_38557_1413970261.1527608832804
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, May 29, 2018 at 11:22:06 AM UTC-4, Vla=
d from Moscow wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">It is the interface that is important.<div><br></div><div>In fact =
the member function <b>substr </b>is a constructor that is based on the cur=
rent object of the type <b>std::basic_string</b>.</div><div><br></div><div>=
The corresponding actual constructors are</div><div><br></div><div><div sty=
le=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);borde=
r-style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#000">basic_string</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#008">const</span><span style=3D"color:#000"> basic_string<=
/span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> st=
r</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> size=
_type pos</span><span style=3D"color:#660">,</span><span style=3D"color:#00=
0"> size_type n</span><span style=3D"color:#660">,</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#008">const</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#606">Allocator</span><span style=3D"c=
olor:#660">&amp;</span><span style=3D"color:#000"> a </span><span style=3D"=
color:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#606">Allocator</span><span style=3D"color:#660">());</span></div></code=
></div><br>and</div><div><br></div><div style=3D"background-color:rgb(250,2=
50,250);border-color:rgb(187,187,187);border-style:solid;border-width:1px;w=
ord-wrap:break-word"><code><div><span style=3D"color:#008">template</span><=
span style=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span><sp=
an style=3D"color:#008">class</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#606">InputIterator</span><span style=3D"color:#660">&gt;<=
/span><span style=3D"color:#000"><br>basic_string</span><span style=3D"colo=
r:#660">(</span><span style=3D"color:#606">InputIterator</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">begin</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#606">InputIterator</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">end</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#008">const</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#606">Allocator</span><span =
style=3D"color:#660">&amp;</span><span style=3D"color:#000"> a </span><span=
 style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#606">Allocator</span><span style=3D"color:#660">());</span><s=
pan style=3D"color:#000"><br><br><br></span></div></code></div><div><br></d=
iv><div>So the member function <b>substr </b>should provide the same functi=
onality.<br></div></div></blockquote><div><br></div><div>Which is just as g=
ood an argument for saying that `substr` <i>shouldn&#39;t exist</i>. If it =
is in fact &quot;a constructor&quot;, then it is an entirely redundant cons=
tructor. Especially with class template argument deduction.</div><div><br><=
/div><div>Why add more redundancy?</div><br></div>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5b5620fb-643f-4574-b042-98e364ee0411%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5b5620fb-643f-4574-b042-98e364ee0411=
%40isocpp.org</a>.<br />

------=_Part_38557_1413970261.1527608832804--

------=_Part_38556_453043783.1527608832804--

.


Author: Richard Hodges <hodges.r@gmail.com>
Date: Tue, 29 May 2018 18:27:30 +0100
Raw View
--=-j1SLlbSvUJ9+y+NHAWcY
Content-Type: multipart/alternative; boundary="=-iGdguvHU8b5gjJ7h/PTY"


--=-iGdguvHU8b5gjJ7h/PTY
Content-Type: text/plain; charset="UTF-8"

On Tue, 2018-05-29 at 08:47 -0700, Nicol Bolas wrote:
> On Tuesday, May 29, 2018 at 11:22:06 AM UTC-4, Vlad from Moscow
> wrote:
> > It is the interface that is important.
> > In fact the member function substr is a constructor that is based
> > on the current object of the type std::basic_string.
> >
> > The corresponding actual constructors are
> >
> > basic_string(const basic_string& str, size_type pos, size_type n,
> > const Allocator& a = Allocator());
> > and
> >
> > template <class InputIterator>
> > basic_string(InputIterator begin, InputIterator end,
> > const Allocator& a = Allocator());
> >
> >
> >
> >
> > So the member function substr should provide the same
> > functionality.
> >
>
> Which is just as good an argument for saying that `substr` shouldn't
> exist. If it is in fact "a constructor", then it is an entirely
> redundant constructor. Especially with class template argument
> deduction.

It's also an argument that substr should be a free function,
implemented in terms of a function class template that could be
customised for UDTs.
for example (minimal exposition):
auto substr(string&& s, size_t, size_t) -> string&&;  // [mutates in
place]
auto substr(string const& s, size_t, size_t) -> string;  // [construct
partial copy]

Of course, expressed this way the first argument could be any model of
MutableContiguousContainer, and it arguably shouldn't be called
substr.

> Why add more redundancy?
>
>
>
>
> --
>
> 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.
>
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/5b5620fb-643f-4574-b042-
> 98e364ee0411%40isocpp.org.
>

--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/1527614850.12066.40.camel%40gmail.com.

--=-iGdguvHU8b5gjJ7h/PTY
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div>On Tue, 2018-05-29 at 08:47 -0700, Nicol Bola=
s wrote:</div><blockquote type=3D"cite" style=3D"margin:0 0 0 .8ex; border-=
left:2px #729fcf solid;padding-left:1ex"><div dir=3D"ltr"><br><br>On Tuesda=
y, May 29, 2018 at 11:22:06 AM UTC-4, Vlad from Moscow wrote:<blockquote ty=
pe=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;paddi=
ng-left:1ex"><div dir=3D"ltr">It is the interface that is important.<div><b=
r></div><div>In fact the member function <b>substr </b>is a constructor tha=
t is based on the current object of the type <b>std::basic_string</b>.</div=
><div><br></div><div>The corresponding actual constructors are</div><div><b=
r></div><div><div style=3D"background-color:rgb(250,250,250);border-color:r=
gb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><=
code><div><span style=3D"color:#000">basic_string</span><span style=3D"colo=
r:#660">(</span><span style=3D"color:#008">const</span><span style=3D"color=
:#000"> basic_string</span><span style=3D"color:#660">&amp;</span><span sty=
le=3D"color:#000"> str</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> size_type pos</span><span style=3D"color:#660">,</span><sp=
an style=3D"color:#000"> size_type n</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">const</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#606">Allocator</=
span><span style=3D"color:#660">&amp;</span><span style=3D"color:#000"> a <=
/span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#606">Allocator</span><span style=3D"color:#660">()=
);</span></div></code></div><br>and</div><div><br></div><div style=3D"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#=
008">template</span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">&lt;</span><span style=3D"color:#008">class</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#606">InputIterator</span><span style=
=3D"color:#660">&gt;</span><span style=3D"color:#000"><br>basic_string</spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#606">InputIterat=
or</span><span style=3D"color:#000"> </span><span style=3D"color:#008">begi=
n</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#606">InputIterator</span><span style=3D"color:#000=
"> </span><span style=3D"color:#008">end</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">con=
st</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Allo=
cator</span><span style=3D"color:#660">&amp;</span><span style=3D"color:#00=
0"> a </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000=
"> </span><span style=3D"color:#606">Allocator</span><span style=3D"color:#=
660">());</span><span style=3D"color:#000"><br><br><br></span></div></code>=
</div><div><br></div><div>So the member function <b>substr </b>should provi=
de the same functionality.<br></div></div><br></blockquote><div><br></div><=
div>Which is just as good an argument for saying that `substr` <i>shouldn't=
 exist</i>. If it is in fact "a constructor", then it is an entirely redund=
ant constructor. Especially with class template argument deduction.</div></=
div></blockquote><div><br></div><div>It's also an argument that substr shou=
ld be a free function, implemented in terms of a function class template th=
at could be customised for UDTs.</div><div><br></div><div>for example (mini=
mal exposition):</div><div><br></div><div><div><font face=3D"monospace" siz=
e=3D"3">auto substr(string&amp;&amp; s, size_t, size_t) -&gt; string&amp;&a=
mp;;  // [mutates in place]</font></div><div><font face=3D"monospace" size=
=3D"3"><div><br></div><div>auto substr(string const&amp; s, size_t, size_t)=
 -&gt; string;  // [construct partial copy]</div><div><br></div><div><div s=
tyle=3D"font-family: Cantarell; font-size: 14.666666984558105px;"><div>Of c=
ourse, expressed this way the first argument could be any model of <i>Mutab=
leContiguousContainer</i>, and it arguably shouldn't be called substr. </di=
v><div><br></div></div></div></font></div></div><blockquote type=3D"cite" s=
tyle=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">=
<div dir=3D"ltr"><div><br></div><div>Why add more redundancy?</div><br></di=
v>



-- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5b5620fb-643f-4574-b042-98e364ee0411%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter">https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/5b5620fb-643f-4574-b042-98e364ee=
0411%40isocpp.org</a>.<br>
</blockquote></body></html>

<p></p>

-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/1527614850.12066.40.camel%40gmail.com=
?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/1527614850.12066.40.camel%40gmail.com</a>.<br />

--=-iGdguvHU8b5gjJ7h/PTY--

--=-j1SLlbSvUJ9+y+NHAWcY
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEE3RJb20ryY2ALx0Tw6HZ1IvK3CgsFAlsNjYIACgkQ6HZ1IvK3
Cgs9qhAAz4XK+JpH1DbhLJwx92JvEkoklCEM4WtgcrqvQlGg+tVgTwfEhH2VVt58
NF4nEFlT788yJQHSZl2LoiyLWbAg0JlekmPke5GDmiQHLwM0cyLlU4Bz2HlliCs+
ezyZOlS7FHbGRjdrAINxIXA+W800RiYs8awRLOAPtmqeuB2/n6VGZ/qU3nOdCKyD
AwCYhyX7mrLvokOuJTJAiHHWA0mu4LoJGvt+G+u4IiIrICfCSwRPK/lSAaDVNE4A
/m+Jl9S0U7TOsOuXGimHKT9VitxNWEdD21bHcL5Nveafu0xnJ+auXKqu4RbJrrlw
IJk1+MAz3vVetcLhAGOLFBT81Ix3nV0EKmHhmOWi2VO5fWM9EUAdz7SwB1UKKPvr
Ch6BE/uDYrl13wEoAGAG8ut0iKhXA1+SFNGO2AIzlOaxGLgHWtgb2JmQSUbenzI8
wmnPjayZNMpA5ZYtW2FNigHIqCZVH83O+AtFzXhkqW5ruLwoh04sEBVshEQF2H7n
0nD2iYKPeCg1hvV8pqLiYAfKTzOBGCRUT08OvhyAwUOOhXUz7Eyti6jOQANcsMLa
xz6zX7bBOHduTEw+ZUMS1bQs3wYmCP6fQyP0GorUu0qfpEWBhYXuTcXp5Cn42FJW
qHPre9rsIHYu2ANjFtvVhS3T/Mk+jnqDf93vTC/sjl4LtPGq9sI=
=/pIw
-----END PGP SIGNATURE-----

--=-j1SLlbSvUJ9+y+NHAWcY--


.