Since most operations on std::vector require / return size_t - the type that I use for indexing. But now I have included all the compiler warnings to fix some problems with the signed / unsigned conversion that I know I have, and this message surprised me:
warning C4365: 'argument': conversion from 'size_t' to '__w64 int', signature mismatch / unsigned
It was generated by this code:
std::vector<int> v; size_t idx = 0; v.insert(v.begin() + idx + 1, 0);
I have many other similar posts suggesting that iterator arithmetic operators accept and return int . Why not size_t ? Correcting all of these messages is pain and does not make my code more beautiful!
source share