| Author |
Message |
Roland Pibinger *nix forums Guru Wannabe
Joined: 31 Mar 2005
Posts: 262
|
Posted: Tue Jun 13, 2006 8:54 pm Post subject:
Re: STL initialize iterator problem with compiler change
|
|
|
On Tue, 13 Jun 2006 19:25:21 +0000, Pedro Sousa <pasousa@inbox.com>
wrote:
| Quote: | mlimber wrote:
g++4 is the more conformant compiler on this point. Your for-loop
should read:
for ( typename vector<T>::iterator i = v.begin(); i != v.end(); ++i)
Can you say where I can read g++4 information about this topic?
I would like to learn it's behavior about the iterators.
|
http://womble.decadentplace.org.uk/c++/template-faq.html#disambiguation |
|
| Back to top |
|
 |
Pedro Sousa *nix forums beginner
Joined: 08 Jun 2006
Posts: 5
|
Posted: Tue Jun 13, 2006 6:32 pm Post subject:
Re: STL initialize iterator problem with compiler change
|
|
|
mlimber wrote:
| Quote: | brianhray@gmail.com wrote:
This works find in Dev Studio and Codewarrior but does not compile
GCC4:
template <class T
void SerializeVector(RArchive &ar, vector<T>& v)
{
for (vector<T>::iterator i = v.begin(); i != v.end(); i++)
SerializeVar(ar, *i);
}
I get "error: expected `;' before 'i'". Even if I just have
"vector<T>::iterator i ". Why would changing compilers cause this
problem? Am I doing something wrong? How do I fix?
--bhr
g++4 is the more conformant compiler on this point. Your for-loop
should read:
for ( typename vector<T>::iterator i = v.begin(); i != v.end(); ++i)
|
Can you say where I can read g++4 information about this topic?
I would like to learn it's behavior about the iterators.
Thanks in advance
Pedro Sousa
--
Posted via a free Usenet account from http://www.teranews.com |
|
| Back to top |
|
 |
mlimber *nix forums Guru
Joined: 06 Sep 2005
Posts: 1249
|
Posted: Tue Jun 13, 2006 6:31 pm Post subject:
Re: STL initialize iterator problem with compiler change
|
|
|
Pedro Sousa wrote:
| Quote: | mlimber wrote:
brianhray@gmail.com wrote:
This works find in Dev Studio and Codewarrior but does not compile
GCC4:
template <class T
void SerializeVector(RArchive &ar, vector<T>& v)
{
for (vector<T>::iterator i = v.begin(); i != v.end(); i++)
SerializeVar(ar, *i);
}
I get "error: expected `;' before 'i'". Even if I just have
"vector<T>::iterator i ". Why would changing compilers cause this
problem? Am I doing something wrong? How do I fix?
--bhr
g++4 is the more conformant compiler on this point. Your for-loop
should read:
for ( typename vector<T>::iterator i = v.begin(); i != v.end(); ++i)
Can you say where I can read g++4 information about this topic?
I would like to learn it's behavior about the iterators.
|
You should ask in a g++ newsgroup, two of which are listed in this FAQ:
http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9
Cheers! --M |
|
| Back to top |
|
 |
mlimber *nix forums Guru
Joined: 06 Sep 2005
Posts: 1249
|
Posted: Mon Jun 05, 2006 6:37 pm Post subject:
Re: STL initialize iterator problem with compiler change
|
|
|
brianhray@gmail.com wrote:
| Quote: | This works find in Dev Studio and Codewarrior but does not compile
GCC4:
template <class T
void SerializeVector(RArchive &ar, vector<T>& v)
{
for (vector<T>::iterator i = v.begin(); i != v.end(); i++)
SerializeVar(ar, *i);
}
I get "error: expected `;' before 'i'". Even if I just have
"vector<T>::iterator i ". Why would changing compilers cause this
problem? Am I doing something wrong? How do I fix?
--bhr
|
g++4 is the more conformant compiler on this point. Your for-loop
should read:
for ( typename vector<T>::iterator i = v.begin(); i != v.end(); ++i)
For the change in the increment, see
http://www.parashift.com/c++-faq-lite/operator-overloading.html#faq-13.15
Cheers! --M |
|
| Back to top |
|
 |
brianhray@gmail.com *nix forums beginner
Joined: 14 Jun 2005
Posts: 4
|
Posted: Mon Jun 05, 2006 6:32 pm Post subject:
STL initialize iterator problem with compiler change
|
|
|
This works find in Dev Studio and Codewarrior but does not compile
GCC4:
template <class T>
void SerializeVector(RArchive &ar, vector<T>& v)
{
for (vector<T>::iterator i = v.begin(); i != v.end(); i++)
SerializeVar(ar, *i);
}
I get "error: expected `;' before 'i'". Even if I just have
"vector<T>::iterator i ". Why would changing compilers cause this
problem? Am I doing something wrong? How do I fix?
--bhr |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|