El 05/11/2025 a las 0:13, Vinnie Falco escribió:
On Tue, Nov 4, 2025 at 2:59 PM Ion Gaztañaga <igaztanaga@gmail.com <mailto:igaztanaga@gmail.com>> wrote:
> https://open-std.org/JTC1/SC22/WG21/docs/papers/2019/p1895r0.pdf <https://open-std.org/JTC1/SC22/WG21/docs/papers/2019/p1895r0.pdf> > <https://open-std.org/JTC1/SC22/WG21/docs/papers/2019/p1895r0.pdf <https://open-std.org/JTC1/SC22/WG21/docs/papers/2019/p1895r0.pdf>>
Interesting, but a bit convoluted for my taste ;-)
Apologies, I should clarify. The paper goes on about Customization Point Objects ("CPOs") and what not, which is a lot of additional complexity. Some of that is justified as it relates to what is needed for a standard library implementation. We don't need all that, so just the plain `tag_invoke` is good enough. Boost.JSON uses this mechanism. The guidance becomes "overload tag_invoke for the desired tag and your type." So for example Boost.JSON declares the "value_to" tag, and in order to convert a json::value to your type T, you would write this function in the same namespace as T:
void tag_invoke( boost::json::value_to_tag, T&, boost::json::value const& );
I like this better than specializing a class template for a few reasons.
Thanks for the explanation, this seems a useful extension of the plain ADL customization, avoiding name clashes between customization points. Best, Ion