Does anyone know how to serialize multidimensional array on cereal, C++ library?
I tested by the source code shown below. but, it complains
"error C2338: Cereal does not support serializing raw pointers - please use a smart pointer"
As shown in the code, a smart pointer "shared_ptr" was already used.
What is the wrong point?
const int square_size = 3;
int** a = new int*[square_size];
for (int i = 0; i < square_size; i++) {
a[i] = new int[square_size];
}
std::shared_ptr<int*> sp(a, [](int** a) {for (int i = 0;i < square_size;i++) { delete a[i]; }});
std::ofstream ofs("output.cereal", std::ios::binary);
cereal::BinaryOutputArchive archive(ofs);
archive(sp);