C++ stl_vector 学习_基本功能模拟实现 模拟实现源码+ stl_vector源码 深拷贝实现
修改:
2023年7月22日12点21分
加上命名空间
环境:VS2019
目前实现了以下基本功能, Member functions (constructor) Construct vector (public member function ) (destructor) Vector destructor (public member function ) operator= Assign content (public member function ) Iterators: begin Return iterator to beginning (public member function ) end Return iterator to end (public member function ) cbegin Return const_iterator to beginning (public member function ) cend Return const_iterator to end (public member function ) Capacity: size Return size (public member function ) resize Change size (public member function ) capacity Return size of allocated storage capacity (public member function ) empty Test whether vector is empty (public member function ) reserve Request a change in capacity (public member function )
Element access: operator[] Access element (public member function )
Modifiers: push_back Add element at the end (public member function ) pop_back Delete last element (public member function ) insert Insert elements (public member function ) erase Erase elements (public member function ) swap Swap content (public member function ) clear Clear content (public member function )
Non-member function overloads relational operators Relational operators for vector (function template ) swap