Everything works fine, but when I want to implement an erase method to mimic the STL one, I find that I can only use iterator instead of T* (as per the typedef above) if I include the function definition within the Vec class definition. If on the other hand I only declare erase within the class definition as follows:
Sorry, that's what I meant. However, if I do that I get the following warning message:
Warning 1 warning C4346: 'Vec<T>::iterator' : dependent name is not a type
which is followed by several errors, some of which I have copied below.
Error 2 error C2143: syntax error : missing ';' before 'Vec<T>::erase'
Error 3 error C2065: 'T' : undeclared identifier
Error 4 error C2923: 'Vec' : 'T' is not a valid template type argument for parameter 'T'
Error 5 error C2146: syntax error : missing ')' before identifier 'it'
Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 7 error C2350: 'Vec<T>::erase' is not a static member
Error 8 error C2059: syntax error : ')'
Open in new window
?