mardi 1 septembre 2020

Cereal macro for vector

ALL.

In the cereal there is a macro CEREAL_NVP, that is suitable for the map/pair.

Is there some kind of macro suitable for std::vector?

I have:

private:
    std::vector <MyObjectId> RecordVector;
    template <class Archive>
    void serialize( Archive &ar )
    {
        ar( CEREAL_NVP( RecordVector ) );
    }

and I still got the error:

/home/ikorot/work/TPW/External/cereal/include/cereal/cereal.hpp:954:9: error: static assertion failed: cereal could not find any input serialization functions for the provided type and archive combination. 

 Types must either have a serialize function, load/save pair, or load_minimal/save_minimal pair (you may not mix these). 
 Serialize functions generally have the following signature: 

 template<class Archive> 
   void serialize(Archive & ar) 
   { 
     ar( member1, member2, member3 ); 
   } 

 
         static_assert(traits::detail::count_input_serializers<T, ArchiveType>::value != 0,
         ^

And I did include cereal/types/vector.hpp.

TIA!

Aucun commentaire:

Enregistrer un commentaire