220 21179 <ba5a67fd-3308-4d33-ad9b-6b09d707cb31@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: Overloading of the family of numeric conversion
 functions std::stoXXX
Date: Fri, 2 Oct 2015 08:27:01 -0700 (PDT)
Lines: 80
Approved: news@gmane.org
Message-ID: <ba5a67fd-3308-4d33-ad9b-6b09d707cb31@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_327_125655239.1443799621170"
X-Trace: ger.gmane.org 1443799630 3081 80.91.229.3 (2 Oct 2015 15:27:10 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 2 Oct 2015 15:27:10 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCXLLRHD7IDRBRWEXKYAKGQE2MN4DRY@isocpp.org Fri Oct 02 17:27:04 2015
Return-path: <std-proposals+bncBCXLLRHD7IDRBRWEXKYAKGQE2MN4DRY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f71.google.com ([209.85.213.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXLLRHD7IDRBRWEXKYAKGQE2MN4DRY@isocpp.org>)
	id 1Zi2Eh-0001XN-MY
	for gclcip-std-proposals@m.gmane.org; Fri, 02 Oct 2015 17:27:03 +0200
Original-Received: by vkfp126 with SMTP id p126sf131887811vkf.3
        for <gclcip-std-proposals@m.gmane.org>; Fri, 02 Oct 2015 08:27:02 -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: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=9SVU14SBV8CvLVIoIXXSbT0NS9sMShFB0p079xpfbFk=;
        b=KmrCvl0XYsJUng4xksZyNH5s9HfOtHE2nJfRnso4pCUOcmC5IUWQAT4BvEix3BFhg/
         TAHfvc+nGpbqvHKSlBvsCfKYnMk/2EapvjrRR8XklEzHSB3/bPTlhuxHHDap/5Iub+1c
         wB2PFpaHlNrGDVooymFZ40r5qMBdlVWY38PKRdlcpuK2vEucF554IolsirfrLkur5GLk
         pHMv9flYIviHzib28W2xnyQVQCE3NsbopusH3b0Vy9qvgVx5v2AnZKRffT7NvdEH9KcW
         js4zqeQHZbFh77/Wtk2eCaTa+gqWcyoIOHUF6sddaKY55d3uLDui+ZnFHu78Gqh+mZzu
         Wzkg==
X-Gm-Message-State: ALoCoQkBJfPKqbVmzC/oz3lhiwyptdY6IOaQjHE385ooWDo1/MTC2zdyPzb7vP/OMda0gLwKA3dW
X-Received: by 10.129.70.6 with SMTP id t6mr14335990ywa.5.1443799622613;
        Fri, 02 Oct 2015 08:27:02 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.132.164 with SMTP id o36ls957123ioi.64.gmail; Fri, 02 Oct
 2015 08:27:01 -0700 (PDT)
X-Received: by 10.50.129.36 with SMTP id nt4mr67577igb.3.1443799621893;
        Fri, 02 Oct 2015 08:27:01 -0700 (PDT)
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:21179
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/21179>

------=_Part_327_125655239.1443799621170
Content-Type: multipart/alternative; 
	boundary="----=_Part_328_1072875596.1443799621170"

------=_Part_328_1072875596.1443799621170
Content-Type: text/plain; charset=UTF-8

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_328_1072875596.1443799621170
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>The C++ Standard includes=C2=A0a family of conversion=
 functions like std::stoi, std::stol, std::stoul and other similar function=
s.</div><div><br></div><div>They allow to convert a string to some arithmet=
ic type.</div><div><br></div><div>However it is not always convinient to us=
e them when you are going to apply the function to a string starting from s=
ome non-zero position.</div><div><br></div><div>In this case you need to us=
e 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 fun=
ction instead of the C++ function.</div><div><br></div><div>So I think you =
have already understood that I want to suggest overloading functions that h=
ave 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 b=
ase =3D 10);</div><div><br></div><div>int stoi(const string&amp; str, std::=
string::size_type pos, size_t* idx =3D 0, int base =3D 10);<br><br></div><d=
iv>What do you think about this?</div><div><br></div></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_328_1072875596.1443799621170--
------=_Part_327_125655239.1443799621170--

.
