课程: Complete Guide to C++ Programming Foundations

免费学习该课程!

今天就开通帐号,24,100 门业界名师课程任您挑!

The vector class

The vector class

- [Instructor] Although we have talked about arrays, I don't recommend using them for your applications as a first option. Instead, you should consider using SDL vectors. These are dynamic-size containers. That means that you may resize them in case you need to have data to your collection or delete elements. The memory required for vectors is managed for you. That means that you don't need to allocate or free that memory manually. However, if the objects you are putting inside your vectors allocate memory manually, well, you're responsible for those as usual. Vector is a generic container class. That means that vectors can be implemented for storing any type of element, ints, floats, strings, or even objects of your own classes. It also means that there are numerous member functions for manipulating vectors conveniently available within the class. Vectors are a part of the C++ standard template library. This is a special set of containers, functions and algorithms included in the C++…

内容