Bob Hairgrove wrote in message ...
On Tue, 21 Mar 2006 17:22:06 +0100, glen stark <st***@ife.ee.ethz.ch>
wrote:Surely there is something clever to do here, besides turning off the
warning?
Yes. Instead of writing this:
vector<something> v;
// fill the vector here...
for (int i=0; i<v.size(); ++i) /* ... */
write this:
for (size_t i=0; i<v.size(); ++i) /* ... */
Even better, use iterators.
Bob Hairgrove
OP: Another 'clunky' way to do it:
std::string String("Good");
// for( int i(0); i < String.size(); ++i ){
// [Warning] comparison between signed and unsigned integer expressions
for( int i(0); size_t( i ) < String.size(); ++i ){
std::cout<<"String.at(" << i << ")="<<String.at( i )<<std::endl;
}
--
Bob R
POVrookie