Can't put float* in std::vector<float[]>

Hello! I have this line that declares a float* to an array.
float* vertex = new float[vec.size()];

And I put some variables in it within a for loop
1
2
    for(...)
        vertex[i] = ...


Then i need to put the float array into a std::vector
vector.push_back(*vertex);

However, I get an error stating the following:
cannot convert argument 1 from 'float' to 'const float (&)[]'

How do I put the float* into the array?
Last edited on
1
2
3
4
5
vector<float*> vector_of_float_pointers;

float* vertex = new float[8]; // an array of 8 float-pointers

vector_of_float_pointers.push_back(vertex ); // vector now contains one float-pointer 


I should also say that this all sounds very wrong. Bad code.

Don't use arrays.
Don't use new.
Last edited on
Topic archived. No new replies allowed.