Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check make_format_args's preconditions #3080

Merged
merged 2 commits into from
Oct 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions stl/inc/format
Original file line number Diff line number Diff line change
Expand Up @@ -3397,11 +3397,15 @@ using wformat_args = basic_format_args<wformat_context>;

template <class _Context = format_context, class... _Args>
_NODISCARD auto make_format_args(_Args&&... _Vals) {
static_assert((_Has_formatter<_Args, _Context> && ...),
"Cannot format an argument. To make type T formattable, provide a formatter<T> specialization.");
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
return _Format_arg_store<_Context, _Args...>{_Vals...};
}

template <class... _Args>
_NODISCARD auto make_wformat_args(_Args&&... _Vals) {
static_assert((_Has_formatter<_Args, wformat_context> && ...),
"Cannot format an argument. To make type T formattable, provide a formatter<T> specialization.");
return _Format_arg_store<wformat_context, _Args...>{_Vals...};
}

Expand Down