More easy serialization for STL containers #33742
Merged
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.
Summary
SUMMARY: Infrastructure "Improve built-in support for (de)serialization of containers"
Purpose of change
To make implementing (de)serialization code as pain- and bug-free as possible by consolidating container serialization in one place.
Describe the solution
std::pair
std::map
withenum
key types by usingwrite_as_string
for the keys (and adding morewrite_as_string
overloads forstd::string
andstring_id
to support existing use cases).Additional context
I've been adding various new things that need serialization recently, and these issues came up. They will be used by my forthcoming PR implementing a statistics tracker, but they could equally be used by many of the existing game classes that currently have home-brew container serialization code. A use case I saw recently was the artifact effect maps in #33471, which use enum keys.