Queue problem solved in C++11