I’ve been using that JSON library a few months. It’s good, but the developer seems to be ignoring std::optional in general. My biggest gripe is that you have to first use ‘contains’ to check for a property before you ‘get’ it, if you don’t want a potential exception. Why isn’t there a ‘get_if’ method that returns an optional?
I wonder if that exact problem would have been easier if C++ had compile-time reflections built into the core language.
I’ve been using that JSON library a few months. It’s good, but the developer seems to be ignoring std::optional in general. My biggest gripe is that you have to first use ‘contains’ to check for a property before you ‘get’ it, if you don’t want a potential exception. Why isn’t there a ‘get_if’ method that returns an optional?
my guess is that library has been around for much longer than std::optional.