-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Changing the default format for unordered_map (or other set) #2132
Comments
What is the exact type of which the serialization is [
[
"food",
5.0
],
[
"amenities",
10.0
]
] ? |
and ResourceType is an enum where I have set up enum to string (rather than int) serialization, to clarify though, this was still the formatting when the enum was represented as an int. EDIT: I'm pretty tired and my brain is clearly not functioning properly: To state it simply, that is a serialization of the unordered_map content shown above. |
I see. Since the keys are not convertible to
|
The problem with option 2 is that from what I understand I would have to do that for every new way I stored objects together so 1 sounds a lot more viable, but I can't find any way to set up implicit |
Sorry, I forgot that it's not possible to provide a |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
What do you want to achieve?
I'm looking to use the library to save the state of a game simulation I'm working on. My knowledge of C++ is fairly basic (have only just begun shifting over from C# and Java) and I have been unable to find anyone else looking to achieve the same thing so I'm turning to here.
I'm trying to keep the save files easily and quickly readable with reasonable success. My only issue is with the way maps are converted, and I was wondering if there was a way to change the format without having to manually define a different from and to _json for every type.
When saving the unordered_map instead of having it a map as
is there an easy way to format this to
for all key value combinations? I have been unable to find anything about this anywhere so finally decided to reach out here as I've seen people be very helpful regarding questions.
The text was updated successfully, but these errors were encountered: