-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Doc: Unclear contract for retention of fmt::arg
results
#2178
Comments
Good catch, thanks! The example in |
A new comment says "The name is always stored by reference", but it is actually copied into the Lines 190 to 205 in 6151d0d
Maybe it's hard to see because |
You are right. Fixed in 8308f52. |
Docs for
fmt::arg()
seem to indicate that the returned object my depend on temporaries created in the function call expression, and that it would be unsafe to use the returned object after the full expression expires.fmt/include/fmt/core.h
Lines 1622 to 1623 in b8ff3c1
That's no longer true as other examples like
fmt/include/fmt/args.h
Lines 180 to 181 in b8ff3c1
auto
variables and passed tofmt::dynamic_format_arg_store
viapush_back
.I want to use
dynamic_format_arg_store
but it looks like I'm breaking thefmt::arg
contract to do it.I know it's safe, but the docs don't quite match the reality.
Should the "It should only be used in a call to a formatting function" be removed or updated?
The text was updated successfully, but these errors were encountered: