23 45 67 89 -999
Contents of q1: 0 23 45 67 89
Contents of q2: 0 23 45 67 89
Process returned 0 (0x0) execution time : 36.094 s
Press any key to continue.
mingw32-g++.exe -c C:\Martin\MalikChapter8\MArtinCopyQueue\MartinCopyQueue\geeksQueue.cpp -o C:\Martin\MalikChapter8\MArtinCopyQueue\MartinCopyQueue\geeksQueue.o
C:\Martin\MalikChapter8\MArtinCopyQueue\MartinCopyQueue\geeksQueue.cpp: In function 'int main()':
C:\Martin\MalikChapter8\MArtinCopyQueue\MartinCopyQueue\geeksQueue.cpp:29:11: error: 'gqiuz2' was not declared in this scope
showq(gqiuz2);
^
Process terminated with status 1 (0 minute(s), 1 second(s))
1 error(s), 0 warning(s) (0 minute(s), 1 second(s))
I am not sure as to why the second one gives the error.
gquiz2 output is: 10 20 30
The queue gquiz is : 10 20 30
gquiz.size() : 3
gquiz.front() : 10
gquiz.back() : 30
gquiz.pop() : 20 30
Process returned 0 (0x0) execution time : 2.338 s
Press any key to continue.
What is puzzling to me is where does the equality function coming from?
I have checked all the function under <queue.h> and the function foroperator= is not here
queues are implemented as containers adaptors, which are classes that use an encapsulated object of a specific container class as its underlying container, providing a specific set of member functions to access its elements. Elements are pushed into the "back" of the specific container and popped from its "front".
and
The standard container classes deque and list fulfill these requirements. By default, if no container class is specified for a particular queue class instantiation, the standard container deque is used.
The underlying container provides the assignment operator, along with everything else which isn't just unique to queue.