USCiLab / cereal

A C++11 library for serialization
BSD 3-Clause "New" or "Revised" License
4.24k stars 764 forks source link

Support __int128 in JSON #554

Open JerryRyan opened 5 years ago

JerryRyan commented 5 years ago

I need to be able to serialize values of type int128 on platforms where it's supported. This pops up in JSON serializations; the existing code ultimately uses operator<< into the output stream, and an int128 is not supported (nor does stringToNumber in json.hpp support an __int128).

There are workarounds for individual __int128s, but types of, say, a std::vector of such types can't be as easily worked around.

I'm happy to take a hack at contributing something here...

AzothAmmo commented 5 years ago

If possible I would prefer a solution to this that could be implemented using standard serialization functions before baking it directly into an archive. This way the solution would work for any of the archive types.

If this doesn't jive with the solution you had in mind, it'd still be good to hear what you were thinking.