I have been looking for a more optimal solution to the following and I cannot seem to find one.
Let\'s say I have a vector:
std::vector v
You can use a ranged based for loop like:
std::vector vars = {1, 2, 3} int multi = 1; for (const auto& e: vars) multi *= e;