Using memcpy to copy a vector

Issue #87 open
Former user created an issue

In, Example 3.2, this: #!c++ memcpy(&fNewData[0], vertexPositions, sizeof(vertexPositions));

should really be this: #!c++ std::copy(vertexPositions, vertexPositions+sizeof(vertexPositions), fNewData.begin());

or even better: #!c++ std::vector<float> fNewData(vertexPositions, vertexPositions+sizeof(vertexPositions));

(std::begin / std::end could be used, but I doubt the tutorials should require C++11 compliance)

Comments (1)

  1. Log in to comment