13 #ifndef MLPACK_CORE_CEREAL_POINTER_VECTOR_WRAPPER_HPP 14 #define MLPACK_CORE_CEREAL_POINTER_VECTOR_WRAPPER_HPP 16 #include <cereal/archives/json.hpp> 17 #include <cereal/archives/portable_binary.hpp> 18 #include <cereal/archives/xml.hpp> 19 #include <cereal/types/vector.hpp> 42 : pointerVector(pointerVec)
45 template<
class Archive>
46 void save(Archive& ar)
const 48 size_t vecSize = pointerVector.size();
49 ar(CEREAL_NVP(vecSize));
50 for (
size_t i = 0; i < pointerVector.size(); ++i)
56 template<
class Archive>
60 ar(CEREAL_NVP(vecSize));
61 pointerVector.resize(vecSize);
62 for (
size_t i = 0; i < pointerVector.size(); ++i)
69 std::vector<T*>& pointerVector;
93 #define CEREAL_VECTOR_POINTER(T) cereal::make_pointer_vector(T) 97 #endif // CEREAL_POINTER_VECTOR_WRAPPER_HPP void save(Archive &ar) const
The objective of this class is to create a wrapper for std::vector that hold pointers by adding also ...
#define CEREAL_POINTER(T)
Cereal does not support the serialization of raw pointer.
PointerVectorWrapper(std::vector< T *> &pointerVec)
PointerVectorWrapper< T > make_pointer_vector(std::vector< T *> &t)
Serialize an std::vector that holds raw pointer object by encapsulating them into a smart pointer...