replace variable length arrays with std::vector