Created on 2022-11-03.00:00:00 last changed 12 months ago
Proposed resolution:
This wording is relative to N4917.
Modify [format.args] as indicated:
namespace std { template<class Context> class basic_format_args { size_t size_; // exposition only const basic_format_arg<Context>* data_; // exposition only public: basic_format_args() noexcept; template<class... Args> basic_format_args(const format-arg-store<Context, Args...>& store) noexcept; basic_format_arg<Context> get(size_t i) const noexcept; }; template<class Context, class... Args> basic_format_args(format-arg-store<Context, Args...>) -> basic_format_args<Context>; }
[ 2023-02-13 Approved at February 2023 meeting in Issaquah. Status changed: Immediate → WP. ]
[ Issaquah 2023-02-06; LWG ]
Unanimous consent (9/0/0) to move to Immediate for C++23.
[ 2023-01-10; LEWG telecon ]
Unanimous consensus in favor.
[ Kona 2022-11-12; Set priority to 3, status to LEWG ]
It seems desirable for this should work:
auto args_store = std::make_format_args<C>(1,2,3); // … std::basic_format_args args = args_store;
i.e. CTAD should deduce the Context argument from the fmt-store-args<C, int, int, int> object returned by make_format_args.
Another example (from Tomasz Kamiński): Given:template<typename Context> void foo(basic_format_args<Context> c); foo(make_format_args<SomeContext>(…)); // won't work foo(basic_format_args(make_format_args<SomeContext>(…))); // should work
Since fmt-store-args is exposition-only, it's not entirely clear that it must have exactly the form shown in [format.arg.store]. E.g. maybe it can have different template arguments, or could be a nested type defined inside basic_format_args. I don't know how much of the exposition-only spec is actually required for conformance. If CTAD is already intended to be required, it's a bit subtle.
If we want the CTAD to work (and I think it's nice if it does) we could make that explicit by adding a deduction guide.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2023-02-13 11:31:32 | admin | set | messages: + msg13387 |
2023-02-13 11:31:32 | admin | set | status: immediate -> wp |
2023-02-07 01:47:11 | admin | set | messages: + msg13282 |
2023-02-07 01:47:11 | admin | set | messages: + msg13281 |
2023-02-07 01:47:11 | admin | set | status: lewg -> immediate |
2022-11-12 01:08:06 | admin | set | messages: + msg13032 |
2022-11-12 01:08:06 | admin | set | status: new -> lewg |
2022-11-05 14:29:52 | admin | set | messages: + msg12929 |
2022-11-03 00:00:00 | admin | create |