how to copy a queu?
hellow there .. i am new here and i do like this web
actually i am a student and i need help with c++ :confused:
how can i copy a queue then using the assignment operatopr (=) in my code?
i don`t need an algorithem i need functions please
Pretty easy, for some type T:
std::queue<T> queue2(queue1); // copy construction
queue3 = queue1; // copy assignment
Use a constructor:
std::queue<my_type> queue (other_queue);
so to copy a queue i should use a
then to use the = operatoer
queue3 = queue1;
as simple as that?
More like: prefer to use the copy constructor. But if you already have a queue, use the copy assignment operator.
thanks alot laserlight ;*
great chance to have u as a tutor