Why does std queue not define a swap method specialisation
Posted
by Jamie Cook
on Stack Overflow
See other posts from Stack Overflow
or by Jamie Cook
Published on 2009-06-02T01:50:52Z
Indexed on
2010/05/15
21:04 UTC
Read the original article
Hit count: 305
I've read that all stl containers provide a specialisation of the swap algorithm so as to avoid calling the copy constructor and two assignment operations that the default method uses. However, when I thought it would be nice to use a queue in some code I was working on I noticed that (unlike vector and deque) queue doesn't provide this method? I just decided to use a deque instead of a queue, but still I'm interested to know why this is?
© Stack Overflow or respective owner