Topic: why no method clear() in STL-stack
Author: "Konstantin Baumann" <kostab@uni-muenster.de>
Date: 1997/08/13 Raw View
Hi!
Why isn't there a method clear() in the STL-stack and STL-queue (like in
all other STL-containers)?
I would like to write:
stack<...> s;
...
s.clear();
But I have to write something like this:
while(!s.empty()) { s.pop(); }
or
s = stack<...>;
Ciao, Kosta
---
[ 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
]
[ FAQ:
http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy:
http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu
]
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
Author: Ralf Stoffels <stoffels@faho.rwth-aachen.de>
Date: 1997/08/15 Raw View
> Why isn't there a method clear() in the STL-stack and STL-queue (like in
> all other STL-containers)?
These are only adaptors, usually for deque.
Why do you do not use deque ?
Ralf
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: Marcelo Cantos <marcelo@janus.mds.rmit.edu.au>
Date: 1997/08/17 Raw View
Ralf Stoffels <stoffels@faho.rwth-aachen.de> writes:
>
> > Why isn't there a method clear() in the STL-stack and STL-queue (like in
> > all other STL-containers)?
>
> These are only adaptors, usually for deque.
> Why do you do not use deque ?
Or put another way: clear() is not part of the semantics of a stack or
a queue.
--
______________________________________________________________________
Marcelo Cantos, Research Assistant __/_ marcelo@mds.rmit.edu.au
Multimedia Database Systems Group, RMIT / _ Tel 61-3-9282-2497
L2/723 Swanston St, Carlton VIC 3053, Aus/ralia ><_>Fax 61-3-9282-2490
Acknowledgements: errors - me; wisdom - God; sponsorship - RMIT
[ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ]
[ about comp.lang.c++.moderated. First time posters: do this! ]
---
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]