Don't use array new[] directly. There are bugs when conducting operators within the array [] syntax for new so precalculate the desired size first and then call array new[]