13 #ifndef MLPACK_CORE_CEREAL_POINTER_VECTOR_VARIANT_WRAPPER_HPP 14 #define MLPACK_CORE_CEREAL_POINTER_VECTOR_VARIANT_WRAPPER_HPP 23 template<
typename... VariantTypes>
34 template<
typename... VariantTypes>
48 template<
typename... VariantTypes>
53 std::vector<boost::variant<VariantTypes...>>& vecPointerVar)
54 : vectorPointerVariant(vecPointerVar)
57 template<
class Archive>
58 void save(Archive& ar)
const 60 size_t vecSize = vectorPointerVariant.size();
61 ar(CEREAL_NVP(vecSize));
62 for (
size_t i = 0; i < vectorPointerVariant.size(); ++i)
68 template<
class Archive>
72 ar(CEREAL_NVP(vecSize));
73 vectorPointerVariant.resize(vecSize);
74 for (
size_t i = 0; i < vectorPointerVariant.size(); ++i)
81 std::vector<boost::variant<VariantTypes...>>& vectorPointerVariant;
92 #define CEREAL_VECTOR_VARIANT_POINTER(T) cereal::make_vector_pointer_variant(T) 96 #endif // CEREAL_POINTER_VECTOR_VARIANT_WRAPPER_HPP PointerVectorVariantWrapper(std::vector< boost::variant< VariantTypes... >> &vecPointerVar)
PointerVectorVariantWrapper< VariantTypes... > make_vector_pointer_variant(std::vector< boost::variant< VariantTypes... >> &t)
Serialize a std::vector of boost variants in which the variant in each boost variant is a raw pointer...
The objective of this class is to create a wrapper for a vector of boost::variant that holds pointer...
void save(Archive &ar) const
#define CEREAL_VARIANT_POINTER(T)
Cereal does not support the serialization of raw pointer.