Add to_node() implementations for STL container types #465
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR has added builtin implementations of the
to_node()
function which are used when constructing afkyaml::basic_node
object with arbitrary types.Before this PR, minimal builtin implementation was provided so that converting to a basic_node object from its template parameter types (like
fkyaml::basic_node::sequence_type
), which wasn't much helpful.Now, objects of many existing STL container types (like
std::vector
,std::unordered_map
orstd::tuple
) can be used as an argument of thefkyaml::basic_node
constructor.See the updated documentation for supported STL container types.
Furthermore, you can, of course, provide your own custom
to_node()
implementation for non-standard types just as before and such a type can be used as the element type of STL container types.If you run the following code, for example:
then the output will be:
Pull Request Checklist
Read the CONTRIBUTING.md file for detailed information.
Please don't
#ifdef
s or other means.