I’m trying to do the following:
I have:
std::vector<std::vector<GLdouble[2]>> ThreadPts(4);
then I try to do:
GLdouble tmp[2];
while(step--)
{
fx += dfx;
fy += dfy;
dfx += ddfx;
dfy += ddfy;
ddfx += dddfx;
ddfy += dddfy;
tmp[0] = fx;
tmp[1] = fy;
ThreadPts[currentvector].push_back(tmp);
}
But the compiler says:
Error 15 error C2440: ‘initializing’ : cannot convert from ‘const GLdouble [2]’ to ‘double [2]’ C:\Program Files\Microsoft Visual Studio 9.0\VC\include\vector 1211
How could I do this then?
I’m using VS 2008 and don;t have std::array, and I don’t have boost.
Thanks
A C-style array is not assignable, so it cannot be used as the value type of a
vector.If you are using at least C++11, you can
#include <array>and usestd::array. (Historically available in Visual C++ 2008 SP1 asstd::tr1::array).https://en.cppreference.com/w/cpp/container/array
If you don’t have that, you may be able to simply copy the Boost Array header into your project and use it on its own; it doesn’t rely on many other parts of Boost, and those on which it does rely can be easily removed.