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
Would it be possible to define concepts that check if a type can be serialized (or reflected)?
I know there are static assertions in place already, but I would really like to have a way to do something like
static_assert( is_serializable<MyType> )
The text was updated successfully, but these errors were encountered:
@hlewin , there are currently no such static assertions.
I think it's certainly doable, but it might be slightly more tricky than you think. What you would want to do is to write a concept that checks whether parsing::Parser<R, W, MyType>::write(...) compiles. (And if you want to support is_deserializable<MyType> as well you could check whether parsing::Parser<R, W, MyType>::read(...) compiles.)
I am assuming that you want to do this independently of any particular serialization format. So that means you have to write your own "mock reader" and "mock writer" for this concept.
The concepts for the reader and writer are laid out in here:
Hello!
Would it be possible to define concepts that check if a type can be serialized (or reflected)?
I know there are static assertions in place already, but I would really like to have a way to do something like
The text was updated successfully, but these errors were encountered: