I am working with boost and an a two dimensional array of floats expressed like a double pointer (float**). By the moment I am allocating memory two load the value (when deserializing), I don't know and I did not find any information on how to do it.
int i;
array = (float**) malloc(N * sizeof(float*));
assert(array == NULL);
for (i=0; i<N; i++) {
array[i] = (float*) malloc(N * sizeof(float));
assert(array[i] == NULL);
}
I tried a few things like serializing one by one the arrays inside but is not working. Also you know some documentation about this? I found a few examples of serialization but they are very simple.
Thank you.
EDIT
I changed the mallocs by constructors of float type. The case is that now is not possible even to compile.
if (Archive::is_loading::value)
{
assert(array == NULL);
array = new float*[N];
int i;
for (i=0; i<N; i++) {
assert(array[i] == NULL);
array[i] = new float[M];
}
}
ar & array;
This is giving me the following error:
error: request for member ‘serialize’ in ‘t’, which is of non-class type ‘float*’
t.serialize(ar, file_version);
It's not possible to serialize float* or I am missing something?