On Tue, Oct 22, 2019 at 2:53 PM Gavin Lambert via Boost < boost@lists.boost.org> wrote:
So I'm curious why it should be different here. Does the doc goes into
On 23/10/2019 05:25, Vinnie Falco wrote: that already?
`json::value` is not `variant<...>` for the same reason that `string_view` is not `std::pair
`. That's a good reason for not inheriting from it.
It's not a good reason for not using it as a private member, to avoid reimplementing the variant-storage concept. (Though there may be other good reasons for that.)
There are always two kinds of dependencies, logical and physical. Logically, you use something as a private member, you're ok, but physically you're still dependent on it, and that may be a problem. Further, std::variant may be problematic for portability, and it may or may not be as efficient as something hand-written specifically for the purpose. Consider that if performance is critical, you don't want to deal with "I changed my compiler and now your JSON parser runs 2x slower".