diff --git a/doc/api.rst b/doc/api.rst index bf8dbbe6..c6665daa 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -54,7 +54,7 @@ participate in an overload resolution if the latter is not a string. Named arguments --------------- -.. doxygenfunction:: fmt::arg(string_view, const T&) +.. doxygenfunction:: fmt::arg(const S&, const T&) Named arguments are not supported in compile-time checks at the moment. diff --git a/include/fmt/core.h b/include/fmt/core.h index 53627de8..00f9ffb1 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1385,10 +1385,10 @@ typename buffer_context::type::iterator vformat_to( \rst Returns a named argument to be used in a formatting function. - Usage is analogous to `std::reference_wrapper - `_, - except that rvalues references are not disabled. - The user should take care to only pass in temporaries when + The named argument holds a reference and does not extend the lifetime + of its arguments. + Consequently, a dangling reference can accidentally be created. + The user should take care to only pass this function temporaries when the named argument is itself a temporary, as per the following example. **Example**:: @@ -1401,11 +1401,9 @@ inline internal::named_arg arg(const S& name, const T& arg) { return {name, arg}; } -/// \cond // Disable nested named arguments, e.g. ``arg("a", arg("b", 42))``. template void arg(S, internal::named_arg) = delete; -/// \endcond template struct is_contiguous : std::false_type {};