Andre Poenitz wrote:

> On Wed, Feb 19, 2003 at 07:47:26PM +0100, Alfredo Braunstein wrote:
>> Sorry for the dumb question, but why is it that a std::queue doesn't have
>> a swap() method while list, map, set and vector all have it ?
> 
> Doesn't it have one?
> 
> queue is implemented to top of deque, which has one.
> And swap is listed as container requirement in 23.1.
> 
> Andre'
> 

ab:~$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
ab:~$ rpm -q libstdc++-devel
libstdc++-devel-2.96-113
ab:~$ cat test.cpp
#include <queue>

int main (int, char **)
{
        queue<int> a;
        queue<int> b;
        a.swap(b);
}
ab:~$ g++ test.cpp -Wall
test.cpp: In function `int main (int, char **)':
test.cpp:7: no matching function for call to `queue<int, deque<int,
allocator<int>, 0> >::swap (queue<int, deque<int, allocator<int>, 0> >
&)'

So it seems g++ 2.96 doesn't have it. Or am I overlooking something?

Regards, Alfredo


Reply via email to