What exactly the call std::vector::sizedepends on the specific implementation of the standard library. However, the standard sets several limitations on what it can and cannot do. In particular, calling in sizerequires a constant time, which means that it cannot count elements (which would be linear in the size of the container, but not constant).
, , : ( ) ( ). , beginning. : , end - beginning.
.