Hi all,
I'm using this code for handling
sf::Texture objects and it works almous fine so far.
Texture & Textures::add(const string & name, const string & directory)
{
map<string, Texture>::const_iterator it = tekstures.find(name);
if (it != textures.end())
return textures.at(name);
Texture tex;
tex.loadFromFile(directory);
textures[name] = tex;
return textures.at(name);
}
And I tried doing this:
void Sounds::add(const string & name, const string & directory)
{
map<string, Sound>::const_iterator it = sounds.find(name);
if (it != sounds.end())
return;
SoundBuffer buffer;
bufor.loadFromFile(directory);
Sound sound;
sound.setBuffer(buffer);
sounds[name] = sound; // here I get Runtime error
}
The Runtime Error I get says
Expression: map/set iterator is not incrementable
How can I solve it?