Created on 2022-12-11.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4917.
Modify [format.range.formatter] as indicated:
[…]namespace std { template<class T, class charT = char> requires same_as<remove_cvref_t<T>, T> && formattable<T, charT> class range_formatter { formatter<T, charT> underlying_; // exposition only basic_string_view<charT> separator_ = STATICALLY-WIDEN<charT>(", "); // exposition only basic_string_view<charT> opening-bracket_ = STATICALLY-WIDEN<charT>("["); // exposition only basic_string_view<charT> closing-bracket_ = STATICALLY-WIDEN<charT>("]"); // exposition only public: constexpr void set_separator(basic_string_view<charT> sep) noexcept; constexpr void set_brackets(basic_string_view<charT> opening, basic_string_view<charT> closing) noexcept; constexpr formatter<T, charT>& underlying() noexcept { return underlying_; } constexpr const formatter<T, charT>& underlying() const noexcept { return underlying_; } […] }; }constexpr void set_separator(basic_string_view<charT> sep) noexcept;-7- Effects: Equivalent to: separator_ = sep;
constexpr void set_brackets(basic_string_view<charT> opening, basic_string_view<charT> closing) noexcept;-8- Effects: Equivalent to:
opening-bracket_ = opening; closing-bracket_ = closing;
Modify [format.range.fmtdef] as indicated:
namespace std { template<ranges::input_range R, class charT> struct range-default-formatter<range_format::sequence, R, charT> { // exposition only private: using maybe-const-r = fmt-maybe-const<R, charT>; // exposition only range_formatter<remove_cvref_t<ranges::range_reference_t<maybe-const-r>>, charT> underlying_; // exposition only public: constexpr void set_separator(basic_string_view<charT> sep) noexcept; constexpr void set_brackets(basic_string_view<charT> opening, basic_string_view<charT> closing) noexcept; […] }; }constexpr void set_separator(basic_string_view<charT> sep) noexcept;-1- Effects: Equivalent to: underlying_.set_separator(sep);.
constexpr void set_brackets(basic_string_view<charT> opening, basic_string_view<charT> closing) noexcept;-2- Effects: Equivalent to: underlying_.set_brackets(opening, closing);.
Modify [format.tuple] as indicated:
[…]namespace std { template<class charT, formattable<charT>... Ts> struct formatter<pair-or-tuple<Ts...>, charT> { private: tuple<formatter<remove_cvref_t<Ts>, charT>...> underlying_; // exposition only basic_string_view<charT> separator_ = STATICALLY-WIDEN<charT>(", "); // exposition only basic_string_view<charT> opening-bracket_ = STATICALLY-WIDEN<charT>("("); // exposition only basic_string_view<charT> closing-bracket_ = STATICALLY-WIDEN<charT>(")"); // exposition only public: constexpr void set_separator(basic_string_view<charT> sep) noexcept; constexpr void set_brackets(basic_string_view<charT> opening, basic_string_view<charT> closing) noexcept; […] }; }constexpr void set_separator(basic_string_view<charT> sep) noexcept;-5- Effects: Equivalent to: separator_ = sep;
constexpr void set_brackets(basic_string_view<charT> opening, basic_string_view<charT> closing) noexcept;-6- Effects: Equivalent to:
opening-bracket_ = opening; closing-bracket_ = closing;
[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Voting → WP. ]
[ 2023-01-06; Reflector poll ]
Set status to Tentatively Ready after eight votes in favour during reflector poll.
The set_separator and set_brackets of range_formatter only invoke basic_string_view's assignment operator, which is noexcept, we should add noexcept specifications for them.
In addition, its underlying function returns a reference to the underlying formatter, which never throws, they should also be noexcept. Similar rules apply to range-default-formatter and formatter's tuple specialization.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2023-02-13 10:17:57 | admin | set | messages: + msg13365 |
2023-02-13 10:17:57 | admin | set | status: voting -> wp |
2023-02-06 15:33:48 | admin | set | status: ready -> voting |
2023-01-06 14:41:04 | admin | set | messages: + msg13175 |
2023-01-06 14:41:04 | admin | set | status: new -> ready |
2022-12-11 18:59:35 | admin | set | messages: + msg13152 |
2022-12-11 00:00:00 | admin | create |