Get rid of std::vector in copyLikeDimenions, use a local array instead