K
klucar
I'll start off differently by showing what I know how to do:
valarray<float> va(100, 0.0f);
float* fp;
fp = &va[0];
some_c_function( fp, va.size() );
What I want to do though is quite the opposite:
float* fp;
valarray<float> va;
&va[0] = fp; // this doesn't work on many levels
What I am trying to show is that I want to construct a valarray, but
use some pointer (from shared memory for example) to initialize the
valarray. I want to overlay a valarray on a c-style array so I don't
suffer the penalty of copying all the data from the array like the
following constructor does:
float af1 [] = {0, 1, 2, 3};
valarray <float> vf1 (af1, 4);
Is this possible with just STL or do I need to dive in to some other
C++ numerics library?
valarray<float> va(100, 0.0f);
float* fp;
fp = &va[0];
some_c_function( fp, va.size() );
What I want to do though is quite the opposite:
float* fp;
valarray<float> va;
&va[0] = fp; // this doesn't work on many levels
What I am trying to show is that I want to construct a valarray, but
use some pointer (from shared memory for example) to initialize the
valarray. I want to overlay a valarray on a c-style array so I don't
suffer the penalty of copying all the data from the array like the
following constructor does:
float af1 [] = {0, 1, 2, 3};
valarray <float> vf1 (af1, 4);
Is this possible with just STL or do I need to dive in to some other
C++ numerics library?