I'm writing this answer because the other two, including the accepted one, are both wrong. The type of std::vector's size() is not unsigned int, nor it is size_t.
The type of the size of an std::vector is std::vector::size_type.
That's it. On some architecture and for some compilers it might be the same as size_t, in some others it might not. The assumption that a variable of type size_t can hold the same values than one of type std::vector::size_type can fail.
To check that your vector has the right size you could do something like:
if(vec.size() != static_cast::size_type>(expected_size)) {
std::cerr << "Error!" << std::endl;
}