P3876R1 — Extending support to more character types (11 items) SG16
Jan Schultke, Peter Bindels
This paper proposes extending std::to_chars and std::from_chars to support all character types (char8_t, char16_t, char32_t, and wchar_t) in addition to the existing char support. New function templates and corresponding result types (u8to_chars_result, u16to_chars_result, etc.) with alias templates to_chars_result_t and from_chars_result_t are introduced to avoid an explosion of non-template overloads. The proposal also re-specifies std::format's wchar_t formatting path to call the new wchar_t to_chars overload directly rather than transcoding from char output.

References — Anthropic Citations API

[1]
"using u8to_chars_result = basic_to_chars_result { }; // maybe?"
[2]
"template from_chars_result_t from_chars(T* first, T* last, U& value, chars_format fmt = chars_format::general);"
[3]
"template constexpr from_chars_result_t from_chars(T* first, T* last, U& value, int base = 10);"
[4]
"All Unicode encodings are designed so that code only code points in the Basic Latin block can be encoded with code units in the range [0, 0x7f)."
[5]
"The output style of all functions named from_chars is specified in terms of characters in the basic character set (and thus in terms of their Unicode code points) or directly in terms of code..."
[7]
"A possible implementation is to call the `constexpr to_chars(char*, /* .../*)`"
Summary: Proposes class templates basic_to_chars_result and basic_from_chars_result plus new function templates for to_chars and from_chars that accept char8_t, char16_t, char32_t, and wchar_t, extending beyond char. Seven defects were found spanning ill-formed syntax, incorrect template constraints, missing const qualifiers, and wording inconsistencies.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.