I have std::vector<int> around, in which I need to update(/overwrite) N values starting at position X.
Imagine a list of vertices holding vertexes for the whole room.
Randomly, you move the chair and you need to update only those vertices which
belong to the chair, so you need to update a set of chair vertices within the whole room vertices list.
Pseudocode:
void CVertexBuffer::Update(int iOffset, const std::vector<tVertex>& vVerticesList)
{
// Update VAO
...
//
// Update m_vVertices (holding current vertices list)
// with vVerticesList (holding updated vertices data )
// starting at position iOffset
// The size of m_vVertices never changes
//
// The Dumb way ( just for pseudocoding )
for(int a = iOffset; a < vVerticesList.size(); a++)
{
m_vVertices[a] = vVerticesList[a-iOffset];
}
}
Is there something I can use within std::vector to do that ?
You can directly use
std::copy: