Mail Archives: djgpp/1997/11/14/07:46:03
From: | cdkrug AT aol DOT com (CDKrug)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Mysterious C++ STL compiler message
|
Date: | 9 Nov 1997 18:26:26 GMT
|
Lines: | 44
|
Message-ID: | <19971109182601.NAA28166@ladder01.news.aol.com>
|
NNTP-Posting-Host: | ladder01.news.aol.com
|
Organization: | AOL http://www.aol.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
As part of my ongoing effort to gain competence in C++, I've been attempting
to rewrite my circa 1982 equation parsar from Fortran IV to C++. The class
below returns the following error message on compilation:
/djgpp/lang/cxx/stack.h.29:: operators is not an agregate type
What the heck does it mean by that? Am I overlooking something obvious, is
there an error in gcc or what?
// This is the infix to post fix converter
#include <stack>
#include <_string.h>
enum operators { leftparen, plus, minus, times, divide};
String opString(operators theOp)
{
switch (theOp) {
case plus: return " + ";
case minus: return " - ";
case times: return " * ";
case divide: return " / ";
case leftparen: return " [ ";
default: return "\0";
}
}
void processOp
(operators theOp, stack<operators> & opStack, String & result)
{
// pop stack while operators have higher precedence
while ((! opStack.empty()) && (theOp < opStack.top()))
{
result += opString(opStack.top());
opString.pop();
}
opStack.push(theOp);
}
Charles Krug
- Raw text -