How can I do this more efficiently?
In sense of execution performance: You cannot... Every multiplication will involve the FPU of your CPU, and every multiplication needs to be done separately there.
If you want to get simpler code (that, once compiled, still does the multiplications separately...), you might try to implement some kind of for_each
for tuples, possibly based on this answer, such that you could write a one-liner like this:
foreach(m_size, [](double& v) { v *= 2; });
Not sure if this fits your definition of efficiency, though...
As types are all the same, you could switch to a std::array<double, 3>
and then use standard libraries std::for_each
instead. This could even be further simplified by providing range-based wrappers (unfortunately not yet existing in standard library):
template <typename C, typename F>
void for_each(C& c, F&& f)
{
std::for_each(c.begin(), c.end(), std::move(f));
}