File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -321,8 +321,6 @@ parameterized version.
321321
322322::: arg(const Char*, const T&)
323323
324- Named arguments are not supported in compile-time checks at the moment.
325-
326324### Compatibility
327325
328326::: basic_string_view
Original file line number Diff line number Diff line change @@ -2310,7 +2310,7 @@ template <typename Context> class value {
23102310 template <typename T, FMT_ENABLE_IF(!has_formatter<T, char_type>())>
23112311 FMT_CONSTEXPR value (const T&, custom_tag) {
23122312 // Cannot format an argument; to make type T formattable provide a
2313- // formatter<T> specialization: https://fmt.dev/latest/api.html #udt.
2313+ // formatter<T> specialization: https://fmt.dev/latest/api#udt.
23142314 type_is_unformattable_for<T, char_type> _;
23152315 }
23162316
@@ -2847,6 +2847,10 @@ using vargs =
28472847 * **Example**:
28482848 *
28492849 * fmt::print("The answer is {answer}.", fmt::arg("answer", 42));
2850+ *
2851+ * Named arguments passed with `fmt::arg` are not supported
2852+ * in compile-time checks, but `"answer"_a=42` are compile-time checked in
2853+ * sufficiently new compilers. See `operator""_a()`.
28502854 */
28512855template <typename Char, typename T>
28522856inline auto arg (const Char* name, const T& arg) -> detail::named_arg<Char, T> {
Original file line number Diff line number Diff line change @@ -4147,6 +4147,14 @@ template <typename T, typename Char = char> struct nested_formatter {
41474147
41484148inline namespace literals {
41494149#if FMT_USE_NONTYPE_TEMPLATE_ARGS
4150+ /* *
4151+ * User-defined literal equivalent of `fmt::arg`, but with compile-time checks.
4152+ *
4153+ * **Example**:
4154+ *
4155+ * using namespace fmt::literals;
4156+ * fmt::print("The answer is {answer}.", "answer"_a=42);
4157+ */
41504158template <detail::fixed_string S> constexpr auto operator " " _a() {
41514159 using char_t = remove_cvref_t <decltype (*S.data )>;
41524160 return detail::udl_arg<char_t , sizeof (S.data ) / sizeof (char_t ), S>();
You can’t perform that action at this time.
0 commit comments