Mail Archives: djgpp/1997/08/28/20:24:09
gyroscope <s336627 AT student DOT uq DOT edu DOT au> wrote in article
<3400DF67 DOT 3545 AT student DOT uq DOT edu DOT au>...
> I am wondering what *exactly* is the syntax for implementing templates in
DJGPP.
Your example compiles for me. What's your version of gcc?
When I run "gcc -v" I get "gcc version 2.7.2".
To be real sure your code was working, I added some usage
of the stack class:
#include <ostream.h>
template<class T>
class stack {
public:
T* v;
// etc.
};
int main(void)
{
int One = 1;
stack<int> IntStack;
float Half = 0.5;
stack<float> FloatStack;
IntStack.v = &One;
FloatStack.v = &Half;
cout << "One is " << *IntStack.v << endl;
cout << "Half is " << *FloatStack.v << endl;
return 0;
}
I compiled this with "gcc -o templates templates.cc -lstdcx" and got
no errors.
--
John Bodfish
bodfish AT als DOT ameritech DOT com
- Raw text -