Created on 2019-08-23.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4830.
Modify [charconv.syn], header <charconv> synopsis, as indicated:
[…]
// [charconv.to.chars], primitive numerical output conversion
struct to_chars_result {
char* ptr;
errc ec;
friend bool operator==(const to_chars_result&, const to_chars_result&) = default;
};
to_chars_result to_chars(char* first, char* last, see below value, int base = 10);
to_chars_result to_chars(char* first, char* last, bool value, int base = 10) = delete;
to_chars_result to_chars(char* first, char* last, float value);
[…]
[ 2019-09-14 Issue Prioritization ]
Status to Tentatively Ready and priority to 0 after eight positive votes on the reflector.
[charconv.to.chars] does not present an overload for bool (because it is neither a signed nor unsigned integer type), so an attempt to call to_chars with a bool argument would promote it to int and unambiguously call the int overload of to_chars.
This was not intended, since it is not obvious that the correct textual representation of a bool is 0/1 (as opposed to, say, "true"/"false"). The user should cast explicitly if he wants the 0/1 behavior. (Correspondingly, there is no bool overload for from_chars in the status quo, and conversions do not apply there because of the reference parameter.)History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2019-11-19 14:48:30 | admin | set | status: voting -> wp |
2019-10-07 02:48:00 | admin | set | status: ready -> voting |
2019-09-14 16:39:55 | admin | set | messages: + msg10614 |
2019-09-14 16:39:55 | admin | set | status: new -> ready |
2019-08-27 18:47:30 | admin | set | messages: + msg10588 |
2019-08-23 00:00:00 | admin | create |