Topic: Q: on valarray - please comment
Author: jarausch@numa1.igpm.rwth-aachen.de (Helmut Jarausch)
Date: 1997/03/07 Raw View
Hi !
Studying the draft sections about VALARRAY, several questions came up to me.
- how can I pass the 'raw data' to a C or FORTRAN function?
As far as I understand 26.3.2.3(3) it should be safe to pass &V[0]
(if V is a valarray) BUT this seems to be guarantueed for non-const
valarrays. How can I pass a const valarray. Probably I cannot
rely on &V == &V[0] !? Can I still rely on &V[0] pointing to the
first element of the array?
- How efficient is the constructor valarray( const slice_array<T>& ) ?
As far as I understand, there are no operators which apply to a
slice_array directly. So doing S+T where S and T are slices of
equal length, the compiler must convert to valarray first.
Now I wonder wether an implementation of the conversion can be done
without copying. If it should imply copying it is a pity since
copying is as expensive as adding.
- Why doesn't have the 3rd argument of 'slice' (stride) a default
value of 1. It will be used this way most of the time and I am not
sure if the compiler optimizes it as if there were no 3rd argument.
Thanks for your comments,
---
Helmut Jarausch
Lehrstuhl f. Numerische Mathematik
Institute of Technology
RWTH Aachen
D 52056 Aachen, Germany
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]