Boost logo

Boost :

From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2020-09-15 14:44:09


>> - boost::json::value_to provides a single, clean way to extract
>> values from json, but it's syntactically long. The same functionality
>> in a member function of boost::json::value would be nicer to use.
> Algorithms which can be implemented completely in terms of a class'
> public interface are generally expressed as free functions in separate
> header files. If we were to make `get` a member function of
> `json::value`, then users who have no need to convert to and from
> user-defined types would be unnecessarily including code they never
> use.

To add to that: You can use ADL to avoid naming the namespace:
`value_to<std::string>(json_val)` which is not much longer than:
`json_val.get<std::string>()`
I could have been named it `get_as` though:
`get_as<std::string>(json_val)` but one is as good as the other




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