JSON Voorhees
Killer JSON for C++
jsonv::optional_adapter< TOptional > Class Template Reference

An adapter for optional-like types. More...

#include <jsonv/serialization_util.hpp>

+ Inheritance diagram for jsonv::optional_adapter< TOptional >:

Protected Member Functions

virtual TOptional create (const extraction_context &context, const value &from) const override
 
virtual value to_json (const serialization_context &context, const TOptional &from) const override
 

Additional Inherited Members

- Public Member Functions inherited from jsonv::adapter_for< TOptional >
virtual const std::type_info & get_type () const override
 Get the run-time type this extractor knows how to extract. More...
 
virtual void extract (const extraction_context &context, const value &from, void *into) const override
 Extract a the type from a value into a region of memory. More...
 
virtual value to_json (const serialization_context &context, const void *from) const override
 Create a value from the value in the given region of memory. More...
 

Detailed Description

template<typename TOptional>
class jsonv::optional_adapter< TOptional >

An adapter for optional-like types.

This is for convenience of creating an adapter for things like std::optional or boost::optional.

Template Parameters
TOptionalThe optional container type. It must have a member type named value_type which holds the actual type. It must default-construct to the "none" type and have a single-argument constructor which takes a TOptional::value_type. It must support a boolean conversion operator for checking if the value is none and a unary operator* for getting the underlying value. Both std::optional and boost::optional possess all of these properties.

Definition at line 342 of file serialization_util.hpp.


The documentation for this class was generated from the following file: