Boost logo

Boost Users :

Subject: [Boost-users] Is it ok to pass &my_boost_array_variable[2] into a C function expecting a Type*
From: Anton Daneyko (self_at_[hidden])
Date: 2012-11-29 04:47:14


Hi,
I have a two variables:
boost::array my_boost_array_variable_1<float, 3>;
boost::array my_boost_array_variable_2<float, 3>;

now I want to call a C function with the following signature:
int MPI_Allreduce ( void *sendbuf, void *recvbuf, ...);

I want to pass the address of a particular element of my
my_boost_array_variable_1 and my_boost_array_variable_2 as a first
and second parameter of MPI_Allreduce:
 MPI_Allreduce(&my_boost_array_variable_1[2],
                       &my_boost_array_variable_2[2], ...

or should I rather do:
 MPI_Allreduce(my_boost_array_variable_1.c_array() + 2,
                       my_boost_array_variable_2.c_array() + 2, ...

Thanks,
Anton


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net