queue class : Copy() method

Description

Gets a copy of the caller queue.

Syntax

queueInstance.Copy()

Arguments

None

Return value

ClassDescription
some queueA copied queue.

Sample code

queue{int} orgQueue = new queue{int}();

orgQueue.Enqueue(10);

orgQueue.Enqueue(8);

orgQueue.Enqueue(9);

queue{int} newQueue = orgQueue.Copy();

newQueue.Dequeue(); // 10

newQueue.Dequeue(); // 8

newQueue.Dequeue(); // 9

//---------------

orgQueue.Dequeue(); // 10

orgQueue.Dequeue(); // 8

orgQueue.Dequeue(); // 9

Notes

This method is added in Ver 1.1.0.0.

The returned queue is a shallow copy of the caller queue. That is, the caller and the returned queue refer to the same element.

Links for reference

None

Copyright © Rice All rights reserved.