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

Fields not appearing in the reverse order that I inserted them #108

Open
jwcodee opened this issue Jul 6, 2019 · 1 comment
Open

Fields not appearing in the reverse order that I inserted them #108

jwcodee opened this issue Jul 6, 2019 · 1 comment

Comments

@jwcodee
Copy link

jwcodee commented Jul 6, 2019

Based on build_toml.cpp, I understand that the fields appear in the reverse order of insertion. I'm currently not seeing that. Is the order of fields random?

@marzer
Copy link

marzer commented Nov 26, 2019

The default implementation uses a std::unordered_map for key storage since TOML doesn't mandate anything about key ordering. You can force it to be ordered (i.e. use a std::map) by defining CPPTOML_USE_MAP before including the header. That still won't use the insertion order, but it will use some order.

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

No branches or pull requests

2 participants