Chameleon wrote:
> template<class T>
> void Wastage1D::clever_erase(vector<T> &v, vector<typename
> vector<T>::iterator> &its, vector<T> &vo)
> {
> // ....... code .......
> vector<T>::iterator cur = its.front(), curo = its.front();
> vector<typename vector<T>::iterator>::iterator itscur = its.begin();
> // ....... code .......
> }
> -------------------
>
> gcc fails to compile with this message:
> -------------------
> wastage1d.cpp:148: error: expected `;' before "cur"
> wastage1d.cpp:149: error: expected `;' before "itscur"
> -------------------
>
> how can I put ";" before "cur" or "itscur"?
Either you are inattentive or you didn't write part of the code because
the answer is right there :
vector<typename vector<T>::iterator>::iterator itscur
^^^^^^^^^^^
When a name depends on a template parameter, you must use typename to
indicate to the compiler that what follows is a type name and nothing
else. So your code becomes:
typename vector<T>::iterator cur = its.front(), curo = its.front();
typename vector<typename vector<T>::iterator>::iterator itscur =
its.begin();
> after all these, I believe, for cross-platform code, its better to use
> first gcc (until the completion of the program) and after VS.
The more conforming the compiler is, the better, yes.
Jonathan