#include #include // to use brief syntax always include this header #include // we also need additional traits to work with container types, // instead of including for vector traits, now we also // need traits to work with brief_syntax types. so include everything from // instead of otherwise we'll // get static assert error, saying to define serialize function. #include enum class MyEnum : uint16_t { V1, V2, V3 }; struct MyStruct { uint32_t i; MyEnum e; std::vector fs; // define serialize function as usual template void serialize(S& s) { // now we can use brief syntax with s(i, e, fs); } }; // some helper types using Buffer = std::vector; using OutputAdapter = bitsery::OutputBufferAdapter; using InputAdapter = bitsery::InputBufferAdapter; int main() { // set some random data MyStruct data{ 8941, MyEnum::V2, { 15.0f, -8.5f, 0.045f } }; MyStruct res{}; // serialization, deserialization flow is unchanged as in basic usage Buffer buffer; auto writtenSize = bitsery::quickSerialization(buffer, data); auto state = bitsery::quickDeserialization( { buffer.begin(), writtenSize }, res); assert(state.first == bitsery::ReaderError::NoError && state.second); assert(data.fs == res.fs && data.i == res.i && data.e == res.e); }