fktn-k / fkYAML

A C++ header-only YAML library
MIT License
69 stars 7 forks source link

#127 Generalize conversions between nodes and native data #129

Closed fktn-k closed 1 year ago

fktn-k commented 1 year ago

Conversions between basic_node objects and native data objects have been generalized by newly implemented node_value_converter class.
The node_value_converter delegates converting operations to fkyaml::to_node and fkyaml::from_node fanctor objects which will execute functions implemented for a target native data type with the mechanism of the Argument Dependent Lookup (ADL for short).

User customizations are available by implementing custom to_node()/from_node() OUTSIDE the fkyaml namespace. (maybe in the global namespace.)
The current restriction of the from_node() customization is that target native data types MUST be default constructible.
The restriction above will be fixed in some later PR.

Furthermore, implementations of STL supplementation to use features in C++14 or later has been moved to include/fkYAML/stl_supplement.hpp, which depends on the result of the C++ standard detection executed in include/fkYAML/version_macros.hpp.