Is there a way to “grow” my array as my program co

2020-04-16 18:03发布

I am creating a prime generator in c++ using an array to store primes as I find them and then use them to check against potentials later. Is there a way to "grow" my array as my program continues?

标签: c++ types primes
7条回答
够拽才男人
2楼-- · 2020-04-16 18:57

I think your best bet is probably a std::list; whereas a vector needs to reallocate previously stored items when its reserved space is exceeded, this doesn't happen with a list.

查看更多
登录 后发表回答