Im just getting errors mostly with the function/lines.
1 2 3 4 5 6 7 8 9 10 11
|
template <class t,int Stacksize>
ostream& operator<<(ostream &output,const Stack<t,StackSize> &s)
{
for(int i=0; i<s.Top; i++)
output<<s.Items[i]<<"|";
return output;
}
template class Stack<int,int StackSize>;
template ostream& operator<< (ostream &output, const Stack<int,int StackSize> &s);
| |
specifically:
32 E:\373\S_Stack.cpp `StackSize' was not declared in this scope
32 E:\373\S_Stack.cpp template argument 2 is invalid
33 E:\373\S_Stack.cpp ISO C++ forbids declaration of `s' with no type
34 E:\373\S_Stack.cpp `Top' has not been declared
34 E:\373\S_Stack.cpp request for member of non-aggregate type before ';' token
35 E:\373\S_Stack.cpp `Items' has not been declared
35 E:\373\S_Stack.cpp request for member of non-aggregate type before '[' token
35 E:\373\S_Stack.cpp At global scope:
38 E:\373\S_Stack.cpp missing `>' to terminate the template argument list
38 E:\373\S_Stack.cpp template argument 2 is invalid
38 E:\373\S_Stack.cpp ISO C++ forbids declaration of `StackSize' with no type
38 E:\373\S_Stack.cpp explicit instantiation of non-template `int StackSize'
38 E:\373\S_Stack.cpp expected `;' before '>' token
40 E:\373\S_Stack.cpp missing `>' to terminate the template argument list
40 E:\373\S_Stack.cpp template argument 2 is invalid
40 E:\373\S_Stack.cpp expected `,' or `...' before '>' token
40 E:\373\S_Stack.cpp ISO C++ forbids declaration of `StackSize' with no type
40 E:\373\S_Stack.cpp template-id `operator<< <>' for `std::ostream& operator<<(std::ostream&, int)' does not match any template declaration
i got the code to output from my professor,so i know its not that.I just dont know if the cause of my problems are in the code or somewhere else in my program.