I tried to find with no success how to serialize a generic object. Every solution that was suggested knew the type/ used some external library (i.e boost/cereal).
I have a template
and in it I need to update a file.
The file needs to hold unordered_map<std::string, T>
.
Is there a way to serialize an object T
without knowing it's type/it's members without using an external library?
Asked
Active
Viewed 285 times
0

Elad G
- 25
- 1
- 8
-
1There is no inbuilt way, no. You'd have to write your own serialization library (which is probably not a good use of your time compared to using an external one). – Max Langhof Nov 22 '19 at 15:24
-
Possible duplicate of [Is it possible to serialize and deserialize a class in C++?](https://stackoverflow.com/questions/234724/is-it-possible-to-serialize-and-deserialize-a-class-in-c) – TonySalimi Nov 22 '19 at 16:45