std::quoted is designed to work with standard IOStreams, and boost::format uses such a stream. Because boost::format is specified to work with user-defined types, the latter is not an implementation detail. So it did not surprise me that this compiles:
boost::format("%1%") % std::quoted(std::string{"Hello, world"});
But to me, this seems on the boundary of an implementation detail. Is this supposed to work? And is this portable? std::quoted has an unspecified return type, and it's not clear that passing it via operator% would work.
It is supposed to work: How It Works and Rationale:
accept any types of variables, by relying on streams for the actual conversion to string. This specifically concerns user-defined types, for which the formatting options effects should be intuitively natural.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With