On 13-Jul-2005, David Bateman wrote:
| Even better would be
| | const RowVector y(args(0).vector_value());
| const double *py = y.fortran_vec();
| | since as you say fortran_vec calls make_unique except when
"const", and | since you aren't altering the data past to the
function, in this manner | you avoid a copy.
Still better would be
const RowVector y(args(0).vector_value());
const double *py = y.data();
because if you are only asking for read-only access, you can use the
const data() method and avoid the call to make_unique().
As I recall, the reason for having different names (fortran_vec and
data) was because it was not possible to overload on const in early
C++ dialects. Now that it is possible, I suppose we could use just
one name instead of two.
jwe