Please show me what snip of code is faster.

Code A:
1
2
3
4
5
6
7
  for (auto it = tiles.begin(); it != tiles.end(); it++)
		{
			auto tile = **it;

			Window.draw(tile);
			
		}


Code B:
1
2
3
4
for (int x = 0; x < tiles.size(); x++)
		{
			Window.draw(*tiles[x]);
		}


vector declaration:
std::vector<Tile*> tiles;
They're both comparable. I wouldn't worry about figuring out which one is faster, it likely won't make a difference.

If you really want to know, the only way to know for sure is to profile it.
Topic archived. No new replies allowed.