I am looking to copy the entire contents of a vector into a queue in C++. Is this a built in function or is it nessesary to loop over each element?
The queue's constructor is as follows:
explicit queue ( const Container& ctnr = Container() );
So you can have some vector v and construct a queue from it.
vector v;
deque d;
/* some random magic code goes here */
queue> q(d(v));
However you can't do this to push_back elements in an already initialized q. You could use another Container, empty your queue, append your vector to that container, and create a new queue from that vector; but I'd iterate rather than doing all that.
Final answer: No, there is no such method implemented for queues, you could use deque or iterate your vector.