Avoid using new[] delete[], use std::vector.