Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserving original order #62

Closed
KangJH opened this issue Sep 28, 2020 · 2 comments
Closed

Preserving original order #62

KangJH opened this issue Sep 28, 2020 · 2 comments
Assignees
Labels
feature New feature or enhancement request

Comments

@KangJH
Copy link

KangJH commented Sep 28, 2020

Is your feature request related to a problem? Please describe.

Hi

Is there a way to preserve original order of toml file?
After parse() and serialization(cout << parsed_toml_node), the order in output is different to the original file.
It seems like toml++ reorder according to alphabetical order of key name.
Can you recommend a way to preserve original order of toml file?

Describe the solution you'd like

Additional context

@KangJH KangJH added the feature New feature or enhancement request label Sep 28, 2020
@marzer
Copy link
Owner

marzer commented Sep 28, 2020

No, there no way to do this presently. Since the TOML spec doesn't consider key ordering to be meaningful, neither does this library (the only reason it is re-serialized in alphabetical order is because of the use of std::map under-the-hood, though this may not always be true).

I may implement this at some stage (since it relates strongly to #28), though it won't be any time soon I'm afraid.

@KangJH
Copy link
Author

KangJH commented Sep 29, 2020

Thank you for the answer. I'll keep track #28 also. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or enhancement request
Projects
None yet
Development

No branches or pull requests

2 participants