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
This commit is contained in:
Mike Lui 2019-02-22 10:08:28 -05:00
parent 71e97b4819
commit 1ed12d6324
2 changed files with 5 additions and 7 deletions

View File

@ -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.

View File

@ -1385,10 +1385,10 @@ typename buffer_context<Char>::type::iterator vformat_to(
\rst
Returns a named argument to be used in a formatting function.
Usage is analogous to `std::reference_wrapper
<https://en.cppreference.com/w/cpp/utility/functional/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<T, FMT_CHAR(S)> arg(const S& name, const T& arg) {
return {name, arg};
}
/// \cond
// Disable nested named arguments, e.g. ``arg("a", arg("b", 42))``.
template <typename S, typename T, typename Char>
void arg(S, internal::named_arg<T, Char>) = delete;
/// \endcond
template <typename Container> struct is_contiguous : std::false_type {};