The range-based for loop in comments is copying each item to use it in the the loop body.
You probably want to use a reference to each item with type
auto& instead of a copy with type
auto.
It looks like a const reference would also be possible with
const auto&.
Try this:
for (const auto& content : m_verticesAndTexture)
{
states.texture = &content.second;
target.draw(content.first, states);
}
If you can enable c++17, you could use structured bindings to make this more readable:
for (const auto& [vertices, texture] : m_verticesAndTexture)
{
states.texture = &texture;
target.draw(vertices, states);
}