mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 00:50:35 +00:00
before this change, we already have a `fmt::formatter` specialized for `expression::printer`. but the formatter was implemented by 1. formatting the `printer` instance to an `ostringstream`, and 2. extracting a `std::string` from this `ostringstream` 3. formatting the `std::string` instance to the fmt context this is convoluted and is not an optimal implementation. so, in this change, it is reimplemented by formatting directly to the context. its operator<< is also dropped in this change. please note, to avoid adding the large chunk of code into the .hh file, the implementation is put in the .cc file. but in order to preserve the usage of `transformed(fmt::to_string<expression::printer>)`, the `format()` function is defined as a template, and instantiated explicitly for two use cases: 1. to format to `fmt::context` 2. to format using `fmt::to_string()` Refs #13245 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>