DAW JSON Link
|
It is sometimes desirable to map a class to be parsed like that of another type of mapping or another class. This, can allow parsing the json data as a number and constructing a class. There are two parts, first the type alias describes what parser to use that will allow construction of the type. The to_json_data
static function will return a value of the type that was parsed to.
Another example is we want to store a GNU MP Rational type mpq_class::mpq_class
as a string and use it's constructor to parse the data.
The data for this mapping could look like "12345/56789"
The file cookbook_aliases1_test.cpp shows an example share a type MyClass
has a single member of type std::string
that is serialized and deserialized as a string.