I understand that it is used for serialization and deserialization of a struct but why does anybody want to serialize/deserialize the struct? What's the use case?
1 Answer
EOSLIB_SERIAlIZE is a DataStream Seralizater
, if you want to deep dive into what it does you should go to contracts/eosiolib/serialize.hpp
in your EOS directory. It basically gives the struct extra operators for the serialization
and deserialization
of data to and from the multi_index database
.
if you go deep inside this you will found that it was using BOOST_PP_SEQ_FOR_EACH
macro. If you want to know more on Boost preprocessor + enums
that is what exactly happening here you should go here and personally I would suggest you to go explore more about enums in c++.
-
3Knowing the "how" will not result in understanding the "why." While more details around what the EOSLIB_SERIALIZE macro is doing under the hood is great, OP asked for the use case.– TyrickNov 1, 2018 at 18:07