после перехода на XML «зерновые не смогли найти какие-либо выходные функции сериализации»

Я хочу сериализовать класс Reconstruction в библиотеке под названием theia. Класс Reconstruction имеет функцию сериализации:

friend class cereal::access;
template <class Archive>
void serialize(Archive& ar) {  // NOLINT
ar(next_track_id_,
next_view_id_,
view_name_to_id_,
views_,
tracks_);
}

Сериализация уже на месте работает нормально, как это:

Reconstruction estimated_reconstruction;

[...]
std::ofstream output_writer(output_file, std::ios::out | std::ios::binary);
cereal::PortableBinaryOutputArchive output_archive(output_writer);
output_archive(estimated_reconstruction);

Но когда я изменяю его на XMLOutputArchive (добавляя необходимый #include), он больше не работает!

Reconstruction estimated_reconstruction;
[...]

std::ofstream output_writer(output_file, std::ios::out);
cereal::XMLOutputArchive output_archive(output_writer);
output_archive(estimated_reconstruction);

Ошибка следующая:

[…]

error: static assertion failed: cereal could not find any output 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 );
}

3

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector