Is it safe to do this?
double darray[10];
vector<float> fvector;
fvector.insert(fvector.begin(), darray, darray + 10); // double to float conversion
// now work with fvector
VS2008 gives me a warning about the double to float conversion. How do I get rid of this warning? I don't think it makes sense to cast darray
to float*
as that would change the step size (stride) of the pointer.
Update: I know what the warning indicates. But unlike the "afloat = adouble;" scenario where I can easily apply a cast, I am unable to eliminate the warning in this case.
Edit: I've edited the code so that darray
is no longer a function argument. Thanks to all those of you who pointed it out.