hellow there .. i am new here and i do like this web
actually i am a student and i need help with c++
how can i copy a queue then using the assignment operatopr (=) in my code?
i don`t need an algorithem i need functions please
thanks alot
hellow there .. i am new here and i do like this web
actually i am a student and i need help with c++
how can i copy a queue then using the assignment operatopr (=) in my code?
i don`t need an algorithem i need functions please
thanks alot
Pretty easy, for some type T:
Code:std::queue<T> queue1; // ... std::queue<T> queue2(queue1); // copy construction std::queue<T> queue3; queue3 = queue1; // copy assignment
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Use a constructor:
(Too late)Code:std::queue<my_type> queue (other_queue);
so to copy a queue i should use a
1)default constructor
2)copy constructor
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.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
thanks alot laserlight ;*
great chance to have u as a tutor
thanks alot brafil ;**