November 12th, 2003, 03:34 AM
problem with vector<unsigned int> ???
Hi... I'm far from a master of STL, but I seem to be having some odd behavior with a vector<unsigned int> that I'm using. Basically, if I do this:
I get a warning at the assignment of b of type:
std::vector<unsigned int> vec;
unsigned int b = *(vec.begin());
warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned int', possible loss of data
I'm using VS.NET 2003 with its regular STL (not STLPort). I guess when creating a vector of unsigned int's, it's somehow getting confused and thinking that it's a vector of size_t's? Is this normal behavior? Should I be concerned? Will this warning disappear if I start using STLPort (I'd rather not)? And if it's unfixable, is a size_t the same size as an unsigned int on Win32, Mac, and Linux? I'm trying to make sure my app stays cross-platform.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.