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 1


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++.

  • 3
    Knowing 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.
    – Tyrick
    Commented Nov 1, 2018 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.