220 21189 <14814aa2-7f0f-444a-ac77-073fa41db54b@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vlad from Moscow <vlad.moscow@mail.ru>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Overloading of the family of numeric conversion
 functions std::stoXXX
Date: Fri, 2 Oct 2015 09:00:10 -0700 (PDT)
Lines: 117
Approved: news@gmane.org
Message-ID: <14814aa2-7f0f-444a-ac77-073fa41db54b@isocpp.org>
References: <ba5a67fd-3308-4d33-ad9b-6b09d707cb31@isocpp.org>
 <dc1ce925-57f9-447c-9afc-c8b91659ac76@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1034_182989883.1443801610687"
X-Trace: ger.gmane.org 1443801625 3826 80.91.229.3 (2 Oct 2015 16:00:25 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 2 Oct 2015 16:00:25 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCXLLRHD7IDRBDOUXKYAKGQEJMD3REI@isocpp.org Fri Oct 02 18:00:16 2015
Return-path: <std-proposals+bncBCXLLRHD7IDRBDOUXKYAKGQEJMD3REI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f70.google.com ([209.85.218.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXLLRHD7IDRBDOUXKYAKGQEJMD3REI@isocpp.org>)
	id 1Zi2ko-0002U8-J5
	for gclcip-std-proposals@m.gmane.org; Fri, 02 Oct 2015 18:00:14 +0200
Original-Received: by oixx17 with SMTP id x17sf157989199oix.2
        for <gclcip-std-proposals@m.gmane.org>; Fri, 02 Oct 2015 09:00:13 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:content-type:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=jIRpZBNT7CV12+S3YxaU7N5Ma6T5VoVWJnxb0aA9YGc=;
        b=REpmCQC32JzWMhflsxMQXeXRsJ3msneHcmWIj8fJ7z7WnfBhQVoWOThujbf+89L0j0
         DUgmlqV6tx1FCNDf+w/r6z5VG6+kloZuyhB7EQ/9DeSRe1vDjzb7+220eSQlGl9dSCcV
         +cyI12klJuBfMTQbZbDNBm/HmrNPuBFk90W0tw8cPKwf8OOfQ28zHVUmSTA4aSZkD9mQ
         qf3g3sb/d0D2Yqx5E4Mt3/uYM0uCOYTVaIO0ApfcFeidgEpROyoM//QW9htOlFwD9qJc
         jwU+cllCqePB7uyRF04VSbU2hoLYDuuEe6OWBn7HokfGag0d4J2JsmPpKgxMRWlJMD02
         NjLA==
X-Gm-Message-State: ALoCoQlrvJnr7k+BvPY9GYEH9zexCJu5pBZx/7utvQqmj07X2kV++15GfKAL+FWP4vjuH4YlWxrj
X-Received: by 10.182.117.194 with SMTP id kg2mr14084457obb.49.1443801613803;
        Fri, 02 Oct 2015 09:00:13 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.157.200 with SMTP id g191ls1050047ioe.51.gmail; Fri, 02
 Oct 2015 09:00:11 -0700 (PDT)
X-Received: by 10.50.43.137 with SMTP id w9mr71534igl.17.1443801611707;
        Fri, 02 Oct 2015 09:00:11 -0700 (PDT)
In-Reply-To: <dc1ce925-57f9-447c-9afc-c8b91659ac76@isocpp.org>
X-Original-Sender: vlad.moscow@mail.ru
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:21189
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/21189>

------=_Part_1034_182989883.1443801610687
Content-Type: multipart/alternative; 
	boundary="----=_Part_1035_724783747.1443801610688"

------=_Part_1035_724783747.1443801610688
Content-Type: text/plain; charset=UTF-8

By the way I advice to add in the description of the view_string the 
functions I am proposing.:)

On Friday, October 2, 2015 at 6:35:36 PM UTC+3, Jared Grubb wrote:

> The string_view proposal adds overloads for these functions for 
> string_view, which would let you have everything you are asking for. (
> http://open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3685.html#string.conversions
> )
>
> Jared
>
> On Friday, October 2, 2015 at 8:27:01 AM UTC-7, Vlad from Moscow wrote:
>>
>> The C++ Standard includes a family of conversion functions like 
>> std::stoi, std::stol, std::stoul and other similar functions.
>>
>> They allow to convert a string to some arithmetic type.
>>
>> However it is not always convinient to use them when you are going to 
>> apply the function to a string starting from some non-zero position.
>>
>> In this case you need to use either member function substr to get the 
>> desired substring. or to use another member function c_str that to 
>> apply the corresponding C function instead of the C++ function.
>>
>> So I think you have already understood that I want to suggest overloading 
>> functions that have one more parameter that specifies a position in the 
>> string.
>>
>> For example function stoi can now  look like
>>
>> int stoi(const string& str, size_t* idx = 0, int base = 10);
>>
>> int stoi(const string& str, std::string::size_type pos, size_t* idx = 0, 
>> int base = 10);
>>
>> What do you think about this?
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_1035_724783747.1443801610688
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>By the way I advice to add in the description of the =
view_string the functions I am proposing.:)</div><div><br></div><div>On Fri=
day, October 2, 2015 at 6:35:36 PM UTC+3, Jared Grubb wrote:</div><blockquo=
te class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: =
1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-=
left-style: solid;"><div dir=3D"ltr">The string_view proposal adds overload=
s for these functions for string_view, which would let you have everything =
you are asking for. (<a onmousedown=3D"this.href=3D&#39;http://www.google.c=
om/url?q\75http%3A%2F%2Fopen-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2=
F2013%2Fn3685.html%23string.conversions\46sa\75D\46sntz\0751\46usg\75AFQjCN=
HxpIzfLKJDjVZW2mc3ZuNOGsaRlQ&#39;;return true;" onclick=3D"this.href=3D&#39=
;http://www.google.com/url?q\75http%3A%2F%2Fopen-std.org%2Fjtc1%2Fsc22%2Fwg=
21%2Fdocs%2Fpapers%2F2013%2Fn3685.html%23string.conversions\46sa\75D\46sntz=
\0751\46usg\75AFQjCNHxpIzfLKJDjVZW2mc3ZuNOGsaRlQ&#39;;return true;" href=3D=
"http://open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3685.html#string.conv=
ersions" target=3D"_blank" rel=3D"nofollow">http://open-std.org/jtc1/<wbr>s=
c22/wg21/docs/papers/2013/<wbr>n3685.html#string.conversions</a>)<br><br>Ja=
red<br><br>On Friday, October 2, 2015 at 8:27:01 AM UTC-7, Vlad from Moscow=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex=
; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-wid=
th: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>The C++ Standard =
includes=C2=A0a family of conversion functions like std::stoi, std::stol, s=
td::stoul and other similar functions.</div><div><br></div><div>They allow =
to convert a string to some arithmetic type.</div><div><br></div><div>Howev=
er it is not always convinient to use them when you are going to apply the =
function to a string starting from some non-zero position.</div><div><br></=
div><div>In this case you need to use either member function substr to get =
the desired substring. or to use=C2=A0another member function c_str that to=
 apply=C2=A0the corresponding C function instead of the C++ function.</div>=
<div><br></div><div>So I think you have already understood that I want to s=
uggest overloading functions that have one more parameter that specifies a =
position in=C2=A0the string.</div><div><br></div><div>For example function =
stoi can now=C2=A0 look like</div><div><br></div><div>int stoi(const string=
&amp; str, size_t* idx =3D 0, int base =3D 10);</div><div><br></div><div>in=
t stoi(const string&amp; str, std::string::size_type pos, size_t* idx =3D 0=
, int base =3D 10);<br><br></div><div>What do you think about this?</div><d=
iv><br></div></div></blockquote></div></blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_1035_724783747.1443801610688--
------=_Part_1034_182989883.1443801610687--

.
