
On 2/13/2012 11:04 PM, Daryle Walker wrote:
Wasn't there recently another thread about this? If you didn't read that thread, it referredto another thread from 7 years ago about the same thing. Boost.Format already provides amember function and a free function to convert a format object to a string. The conversionsthrow if the format object hasn't had all of its parameters filled in. You want to add a thirdmethod? Unlike int vs. double, a formatting object and a string are NOT conceptually the samething, so adding an implicit conversion would be bad. (Actually, we should limit implicitconversions in general; so converting weakly-connected types should definitely be out.) Daryle W.
Yes, I do indeed. Both forms of str require extra parens and is a bit awkward for in-place formatting of strings, in particular for error messages like the argument to an exception constructor. Would it go over well if we _removed_ the ability for ostream to take a formatter without an extra function call? After all, you could use str for that too! My impression is that the ostream use-case was thought about, but the exception case was not. I do admit that for a named string variable, initializing it using free-function str isn't too bad. —John