Which way is better/faster in c++11 to clear a container (e.g. queue):
void clean()
{
std::queue<int> empty_q;
std::swap(q_to_clear, empty_q);
}
or using operator=(Q &&) (faster than swap ?)
void clean ()
{
q_to_clear = std::queue<int>{};
}
Or is it essentially the same ?