[PATCH] C++17 P0067R5 std::to_chars and std::from_chars (partial)

Jonathan Wakely jwakely@redhat.com
Mon Oct 2 22:53:00 GMT 2017


On 02/10/17 21:53 +0200, Jakub Jelinek wrote:
>On Mon, Oct 02, 2017 at 03:13:17PM +0100, Jonathan Wakely wrote:
>> This adds the integral overloads of std::to_chars and std::from_chars,
>> including the changes made by P0682R0. Support for floating point types
>> is absent.
>>
>> This uses a number of suggestions from Lars (thanks!) but I might have
>> missed some of his ideas and so could be missing some potential
>> optimizations.
>>
>> An earlier version of the patch was posted in
>> https://gcc.gnu.org/ml/libstdc++/2017-04/msg00025.html
>>
>> 	* include/Makefile.am: Add new <charconv> header.
>> 	* include/Makefile.in: Regenerate.
>> 	* include/precompiled/stdc++.h: Include <charconv>.
>> 	* include/std/charconv: New file.
>> 	(to_chars_result, to_chars, from_chars_result, from_chars): Define.
>> 	* testsuite/20_util/from_chars/1.cc: New test.
>> 	* testsuite/20_util/from_chars/1_neg.cc: New test.
>> 	* testsuite/20_util/from_chars/2.cc: New test.
>> 	* testsuite/20_util/from_chars/requirements.cc: New test.
>> 	* testsuite/20_util/to_chars/1.cc: New test.
>> 	* testsuite/20_util/to_chars/1_neg.cc: New test.
>> 	* testsuite/20_util/to_chars/2.cc: New test.
>> 	* testsuite/20_util/to_chars/requirements.cc: New test.
>>
>> Tested powerpc64le-linux, committed to trunk.
>
>This fails on 32-bit targets, there are too many closing >s if
>__int128_t is missing.
>
>Either of the attached patches fixes this, which one do you prefer (or do
>you want yet another formatting)?

The first one please.

Sorry for not testing it on 32-bit, I must remember to check on
multilib targets, not just ppc64le.




More information about the Gcc-patches mailing list