Mail Archives: djgpp/1997/11/11/15:00:26
Charles Krug (charles AT pentek DOT com) writes:
> I fed the following to gxx:
>
> #include <stack.h>
>
> int main()
> {
> queue<int> fred;
>
> return 0;
> }
>
> And got the following error:
>
> d:/djgpp/lang/cxx/stack.h:57: `int' is not an aggregate type
> d:/djgpp/lang/cxx/stack.h:57: confused by earlier errors, bailing out
> class queue (from stack.h):
>
> template <class Container>
Look. Queue expects a container, not an int. Queues, like stacks, build on
an existing container. You should use
queue< deque<int> > fred;
(Usually, a deque or a list. Deques have O(1) push_front and push_back and
pop_front and pop_back, so they are ideal for queues and stacks.)
--
.*. Where feelings are concerned, answers are rarely simple [GeneDeWeese]
-() < When I go to the theater, I always go straight to the "bag and mix"
`*' bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh
- Raw text -