mirror of
https://github.com/fraillt/bitsery.git
synced 2026-08-24 20:18:28 +00:00
Added serializer/deserializer "cereal like" interface
Added interface BasicSerializer &operator()(T &&head, TArgs &&... tail) and BasicDeserializer &operator()(T &&head, TArgs &&... tail), which are cereal like intefaces so such format of serialization functions were possible:
template<class Archive>
void serialize(Archive & ar, DataType& d){
ar(d.data1, d.data2....);
}
This commit is contained in:
committed by
Mindaugas Vinkelis
parent
c1ae593fb4
commit
aca3139600
@@ -102,6 +102,15 @@ namespace bitsery {
|
||||
archive(std::forward<TArgs>(tail)...);
|
||||
}
|
||||
|
||||
template <typename T, typename... TArgs>
|
||||
BasicDeserializer &operator()(T &&head, TArgs &&... tail) {
|
||||
//serialize object
|
||||
details::ArchiveFunction<BasicDeserializer, T>::invoke(*this, std::forward<T>(head));
|
||||
//expand other elements
|
||||
archive(std::forward<TArgs>(tail)...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* value
|
||||
*/
|
||||
|
||||
@@ -100,6 +100,13 @@ namespace bitsery {
|
||||
archive(std::forward<TArgs>(tail)...);
|
||||
}
|
||||
|
||||
template <typename T, typename... TArgs>
|
||||
BasicSerializer &operator()(T &&head, TArgs &&... tail) {
|
||||
details::ArchiveFunction<BasicSerializer, T>::invoke(*this, std::forward<T>(head));
|
||||
archive(std::forward<TArgs>(tail)...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
* value overloads
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user