From 1ed12d6324ab9f51fbdaabe34bde85ec15221784 Mon Sep 17 00:00:00 2001 From: Mike Lui Date: Fri, 22 Feb 2019 10:08:28 -0500 Subject: [PATCH] Clean up language Remove mentions of `std::reference_wrapper` and rvalues in favor of more common terminology like dangling references. Fix function signature that references `fmt::arg` in the API *.rst --- doc/api.rst | 2 +- include/fmt/core.h | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) 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 {};