delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/07/05:52:52

Newsgroups: comp.os.msdos.djgpp
From: manni DOT heumann AT gmx DOT de (Manni Heumann)
Subject: Re: stl samples or tutorial
References: <005d01bfe74f$4724f420$0307028a AT prmivv03> <002e01bfe7d5$c0c74b80$0307028a AT prmivv03>
X-Newsreader: News Xpress 2.01
Mime-Version: 1.0
Date: Fri, 07 Jul 2000 06:58:56 GMT
NNTP-Posting-Host: ppp36-225.hrz.uni-bielefeld.de
Message-ID: <39657fb2_1@news.uni-bielefeld.de>
X-Trace: 7 Jul 2000 08:58:58 +0200, ppp36-225.hrz.uni-bielefeld.de
Lines: 42
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

>
>Hi everybody,
>I am looking for sample code for stl running with djgpp. I am just testing
>examples from ObjectSpace, but some of them cannot be compiled (stack1.cpp
>for example - see attached file).
>Please let me know about some easy collection of examples which might run
>with djgpp.
>
>Thanks, Petr Maxa.


>#include <iostream.h>
>#include <stl.h>
>
>int main ()
>{
>  stack<deque<int> > s;
>  s.push (42);
>  s.push (101);
>  s.push (69);
>  while (!s.empty ())
>  {
>    cout << s.top () << endl;
>    s.pop ();
>  }
>  return 0;
>}

How could this possibly compile? s is a stack of deques, and you are 
trying to push ints into that. 
This is positively not a problem with djgpp, but with the code.

How old are those samples, anyway? <iostream.h> should not be in modern 
code, use <iostream> instead. And including <stl.h> will give you HUGE 
compile times. It's better to include only those headers you really 
need (<stack> and <deque> in your case).


--

Manni

- Raw text -


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