Topic: Implementation of queue - why not slist?


Author: csc@usenet.nichtich.de (Jakob =?iso-8859-1?Q?Vo=DF?=)
Date: Mon, 19 Mar 2001 21:17:31 GMT
Raw View
AFAIK the STL-class queue is implemented with a deque by standard.
Wouldn't it be more effecient to do this with a single linked list?
BTW the class slist is a SGI extension and not part of the C++ standard - why?

thanks,
  Jakob

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Anon Sricharoenchai <ans@beethoven.cpe.ku.ac.th>
Date: Tue, 20 Mar 2001 13:55:04 GMT
Raw View
Jakob Vo=DF wrote:

> AFAIK the STL-class queue is implemented with a deque by standard.
> Wouldn't it be more effecient to do this with a single linked list?
> BTW the class slist is a SGI extension and not part of the C++ standard=
 - why?
>

You can alter the container used by queue by passing the desired containe=
r type
as a second template argument like this.

   queue<int, list<int> > my_queue;
   queue<int, slist<int> > my_queue;

However, I agree that slist should be included in the standard.  I don't =
know why
they don't.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]