Article ID: 167323
Article Last Modified on 10/17/2003
typedef IntVector::iterator IT ;with the following code:
// Workaround for VC++ 4.2:
#if _MSC_VER == 1020
struct X
{
typedef IntVector::iterator it ;
};
typedef X::it IT ;
#else
typedef IntVector::iterator IT ;
#endif
/* Compile options needed: /GX
*/
#include <iostream>
#include <vector>
typedef vector<int, allocator <int> > IntVector;
// C2955 error on the following line
typedef IntVector::iterator IT ;
void Show (IT i)
{
cout << *i << endl;
}
int main (int argc, char *argv[])
{
IntVector v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
for (IntVector::iterator i = v.begin(); i != v.end(); i++)
{
Show(i);
}
return 0 ;
}
Additional query words: STL iterator
Keywords: kbbug kblangcpp kbprogramming kbcode KB167323