Boost logo

Boost :

From: Hadriel Kaplan (hadrielk_at_[hidden])
Date: 2020-10-02 18:21:06

> On Oct 2, 2020, at 2:02 PM, Richard Hodges via Boost <boost_at_[hidden]> wrote:
> Looking into the code I found that there are overloads of quoted_helper(T&&)
> in the pfr::detail namespace in order to ensure proper quoting of
> std::string and (if present) std::string_view.
> However, there is no means for me to provide a customisation of the quoting
> concept for unsupported types that I might want to quote (such as
> boost::string_view, std::exception, json::string, etc).
> In my view this is a design oversight.

Heh, that was the first thing I asked for on the GitHub issues list. :)

See: <>

There’s an example in that issue for how to create your own version - not for specializing each of your types exactly, but rather re-implementing a bit of PFR's streaming code in your own namespace.

Once you do that, you can do whatever you want - including handling your own custom types and your own customization-point model (i.e., by implementing template specializations, or custom function names, or tag-dispatching, or whatever).

I used it for making `bool` types print “true” or “false” instead of “1” or “0", for example - instead of having to pass `std::boolalpha` into `std::ostream` _everywhere_.


Boost list run by bdawes at, gregod at, cpdaniel at, john at