first of all, your actual code would give you a lot of problems with that loops ( while and for ), and adding or removing items of a list while you are using iterators.
The best solution to your problem is to do a first loop to check all the enemies that have destroyed, and after the check, make a loop to generate them.
std::list<sf::Sprite>::iterator enemyit = enemy.begin(), next;
int erasedEnemies = 0;
while(enemyit != enemy.end())
{
next = enemyit;
next++;
if(enemyit->getGlobalBounds().intersects(player.getGlobalBounds()))
{
enemy.erase(enemyit);
++erasedEnemies;
}
enemyit = next;
}
for( int i = 0; i < erasedEnemies; ++i )
{
sf::Sprite tempSprite(enemytex);
srand(time(NULL));
float y = -200;
float x = rand() % dist + wastage;
tempSprite.setPosition(x, y);
y = y - tempSprite.getGlobalBounds().height * 2;
enemy.push_back(tempSprite);
}
Hope it helps you.