A
aaragon
Hello everyone,
I've been trying to create a simple way to serialize C++ objects so I
can send messages among different processors (using MPI). Something
very simple is shown below:
template <class StorageType>
void Send(StorageType& c, int dest, int tag, MPI_Comm comm) {
typedef typename StorageType::ValueType ValueType;
int size = c.size()*sizeof(ValueType);
char* buffer[size];
memcpy(buffer, &c[0], size);
MPI_Send(&buffer, size, MPI_BYTE, dest, tag, comm);
}
I tested the templated function with arrays of integers and it works
fine. However, when I try to use the dynamic_bitset provided by the
boost library, I cannot pass a reference to c[0] because operator& is
private for that class. Is there another efficient way to do a bitwise
copy???
Thank you all,
a²
I've been trying to create a simple way to serialize C++ objects so I
can send messages among different processors (using MPI). Something
very simple is shown below:
template <class StorageType>
void Send(StorageType& c, int dest, int tag, MPI_Comm comm) {
typedef typename StorageType::ValueType ValueType;
int size = c.size()*sizeof(ValueType);
char* buffer[size];
memcpy(buffer, &c[0], size);
MPI_Send(&buffer, size, MPI_BYTE, dest, tag, comm);
}
I tested the templated function with arrays of integers and it works
fine. However, when I try to use the dynamic_bitset provided by the
boost library, I cannot pass a reference to c[0] because operator& is
private for that class. Is there another efficient way to do a bitwise
copy???
Thank you all,
a²