Vectorize at C++ level