vector to void error

Hello,

i would like to ask how to convert std::vector<int, std::allocator<int> > to void* ?
If I take you literally, it cannot be converted to void*.

What are you trying to accomplish?
i have a vector,

vector<int> V(length);

and i am trying to send the data of the vector

using MPI.

int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag,
MPI_Comm comm)

Is it possible to convert the vector V to void* ? If yes, how ?
MPI_Send(V.data(), V.size(), /* ... */ );
1
2
3
4
5
6
7
std::vector<int>  vec ;

// ...

//int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)

int result = MPI_Send( &vec.front(), vec.size(), MPI_INT, dest, tag, comm ) ;

Thanks !
Topic archived. No new replies allowed.