Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit d0901e4f8e.


Determine if T should be treated as an optional.


Defined in header <boost/json/conversion.hpp>

    class T>
struct is_optional_like

Optionals are serialised as null if empty, or as the stored type otherwise.

Given t, a glvalue of type T, if

then the trait provides the member constant value that is equal to true. Otherwise, value is equal to false.

Users can specialize the trait for their own types if they don't want them to be treated as optionals. For example:

namespace boost {
namespace json {

template <>
struct is_optional_like<your::optional> : std::false_type
{ };

} // namespace boost
} // namespace json

Convenience header <boost/json.hpp>