Boost logo

Boost :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2023-02-08 12:10:51


On Wed, Feb 8, 2023 at 3:49 AM Ruben Perez via Boost
<boost_at_[hidden]> wrote:
> I support the idea of getting rid of json::value for partials
> and get something more constrained.

I'm glad someone said it. The more time that passes, the less I like
this tying of Boost.Mustache to Boost.JSON.

What if there was some abstract interface

    // represents an individual key/value pair
    struct partial
    {
       string_view key;
       virtual void render_value( std::string& ) = 0;
    };

and a concept to adapt any forward range or map of key/value pairs. We
could do interesting things here if we escape the JSON straightjacket.
For example we could allow any user defined type T that supports
operator<< to be used as a value, this neatly expands the set of
supported types without the need to use Describe on them. Asio's IP
addresses would work out of the box (and most of the types from
Boost.URL).

If we carefully craft concepts for generic values and ranges/maps of
key value pairs, support for Boost.JSON types should naturally emerge
without the need to write it explicitly.

Thanks


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk