Do C++ matrix libraries translate compound vector operations to single loops?

I am trying to replicate Fortran90 array syntax using a C++ library. The libraries themselves are discussed at length in this question. They can all do something like this:

D = alpha*A + beta*B + gamma*C


for vectors A, B, C and scalars alpha, beta, gamma. This could be translated as:

for (i = 0; i < D.length; i++)
D[i] = alpha*A[i] + beta*B[i] + gamma*C[i]


which traverses each array a single time, or like:

for (i = 0; i < D.length; i++)
D[i] = alpha*A[i] + beta*B[i]
for (i = 0; i < D.length; i++)
D[i] += gamma*C[i]


The first way is much better for cache performance, and I assume is what fortran compilers do. Are C++ matrix libraries able to translate compound vector expressions into single loops like fortran, or will they emit multiple simple loops?