Skip to content

Macro for adding custom types to Value::as<T>() #45

@heyx3

Description

@heyx3

It would be nice to be able to support our own custom types to the TOML parser through templates, so that we could simply write value.as<My_t>() for any My_t that we want . Based on my reading of the source, it's already possible without touching the source by adding new template specialization for a few types. I made a macro in my project to do this; I haven't tested it yet, but would you be interested in a pull request to add this type of functionality?

I'd also like to provide an automatic way to deserialize a custom type, but I'm not sure how to do that yet; it might require source modification.

Edit: forgot to mention, I also used this in my project to provide parsers for all the different integer and float types, because the project currently only accepts int64_t and double. Would you be interested in that as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions