0

I have this code:

static void convertData(const I* vec, std::string vectorName, std::string filename)
{
     for (unsigned i = 0; i < sizeof(*vec) / sizeof(vec[0]); i++)
     {
                    if ((i + 4) % 4 == 0)
                        fcpp << '\n';
                    if (i == sizeof(*vec) / sizeof(vec[0]) - 1)
                        fcpp << vec[i];
                    else
                        fcpp << vec[i] << ", ";
    }
}

and this is how I callit:

std::vector<float> v = {/*...*/};
convertData(v.data(),"myVec", "vectors");

so I expected to get the length of my vector but I got the length of the pointer which is 4.

how to do to get the length of the vector?

Thanks

0 Answers0