@Andrew Henle he may have profiled it. And there's nothing wrong with wanting to know how to do this kind of operation effeciently. It's already not bad, but at the very least there's some extra allocation going on which is more than trivial to eliminate. It could also simply be an
std::array
, if the op doesn't need dynamic allocation down the road. Although truthfully this would be a better question for the code review stack exchange. —
George 58 secs ago