Check for division by zero.
No need to pre-allocate a STL vector if push_back is used.

You need to do exactly *one* of a) specify the std::vector size and the
initializer and b) extend it with push_back.