Look at the return type. The return type of std::vector::size() is size_type so you better use it. If you use an int you might get an warning about comparison of signed and unsigned types. I often use size_t instead of size_type because then I don't have to write the whole vector type.
begin() and end() returns an iterator so it will not work with an int.