You can create a vector the way that the OP was suggesting, however.
std::vector can have following constructor: explicit vector (size_type n);
which initializes the size of the vector to that size.
Yes, that can make a difference (especially for loading lots of data into a vector), due to memory allocation taking a lot of the computer's resources.
Also, @Stewbond, your example has std::cout << data[2], which is outside the range of the vector. Therefore, the result is undefined.
That constructor reserves space to save memory allocation time, but data.size() will still return 0 until data.push_back() is used. Just thought I should make that clear.