C++ std::vector vs array in the real world

后端 未结 7 1064
逝去的感伤
逝去的感伤 2020-11-27 16:56

I\'m new to C++. I\'m reading "Beginning C++ Through Game Programming" by Michael Dawson. However, I\'m not new to programming in general. I just finished a cha

7条回答
  •  心在旅途
    2020-11-27 17:37

    As far as arrays are considered, simple integer or string arrays are very easy to use. On the other hand, for common functions like searching,sorting,insertion,removal, you can achieve much faster speed using standard algorithms (built in library functions) on vectors. Specially if you are using vectors of objects. Secondly there is this huge difference that vectors can grow in size dynamically as more objects are inserted. Hope that helps.

提交回复
热议问题