www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/11/15:00:26

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: More STL woes
Date: 11 Nov 1997 18:00:33 GMT
Organization: The National Capital FreeNet
Lines: 34
Message-ID: <64a6g1$hnf@freenet-news.carleton.ca>
References: <346881DE DOT 97AEE50F AT pentek DOT com>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet3.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019