In C++ it's very convenient to store array data using the
std::vector
from the STL library. On modern CPUs you can take advantage of vectorized instructions that allow you to operate on multiple data elements at the same time. But how do you combine a
std::vector
with SSE code? For example, you want to sum up each element of a float vector of arbitrary length (in C++ this corresponds to
std::accumulate(v.begin(), v.end(), 0.0f)
). This article will show you how to access the elements of the vector using SSE intrinsics and accumulate all elements into a single value.