iterator for a container<Generic> is deprecated...
Posted: Wed May 10, 2006 6:55 pm
hello, please take a look at my simple example and my compilation warnings...
can you tell me why???
program.cpp
compilation warnings
can you tell me why???
program.cpp
Code: Select all
#include <iostream>
#include <vector>
using namespace std;
template<class Gen>
void printv( const vector<Gen> &somev )
{
for( vector<Gen>::const_iterator e = somev.begin(); e != somev.end(); e++ )
cout << *e << ", ";
}
int main()
{
vector<double> dv( 5, 2.2 );
vector<string> sv( 4, "I love C++" );
printv<double>( dv );
cout << endl;
printv<string>( sv );
cout << endl;
return 0;
}
thanks
beloni@weathered:~/programming/c++/tests$ g++ iterator_for_template.cpp -o iterator_for_template -O2
iterator_for_template.cpp: In function `void printv(const std::vector<Gen,
std::allocator<_CharT> >&)':
iterator_for_template.cpp:11: warning: `std::vector<Gen, std::allocator<_CharT>
>::const_iterator' is implicitly a typename
iterator_for_template.cpp:11: warning: implicit typename is deprecated, please
see the documentation for details
beloni@weathered:~/programming/c++/tests$