Improve Format's handling of temporaries
Summary: `FormatValue` holds non-integral objects by reference, which can cause subtle problems if a formatter is constructed with temporary arguments and used beyond the expression that constructs it. With this diff the arguments are perfectly forwarded into a tuple, so the formatter will take ownership of the temporaries while holding references to lvalues as before. The only downside is that now `FormatValue` objects are constructed every time the formatter is used, rather than only at formatter construction. This should not be noticeable as those objects' constructors should just take a reference to the argument. Note that the format string is still held by reference, but this is fine because it should almost always be a string literal. Reviewed By: ericniebler Differential Revision: D5317382 fbshipit-source-id: ef8355194b634d3751ef1ccca32dd1db29e27c48
Showing
Please register or sign in to comment