You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I figured that for writing data, I need to provide overloads for const objects. However, when calling from a function with a non-const object, it will instead call the de-serialization overload:
object obj;
std::vector<char> bytes;
zpp::bits::out{bytes, zpp::bits::size4b{}}(obj).or_throw(); // this will call the non-const variant, effectively de-serializing the object
As a work-around, I can use std::as_const(obj) when passing the object to ZPP_bits. It would be nice to receive an error here instead.
The text was updated successfully, but these errors were encountered:
Interesting, I will look into that. In the meantime I recommend to try and add a requires clause for each function for archive kind, or go for one function with if constexpr, I believe I had an example in the readme for it.
I am serializing
std::chrono::time_point
and use theserialize
for that purpose:I figured that for writing data, I need to provide overloads for
const
objects. However, when calling from a function with a non-const object, it will instead call the de-serialization overload:As a work-around, I can use
std::as_const(obj)
when passing the object to ZPP_bits. It would be nice to receive an error here instead.The text was updated successfully, but these errors were encountered: