细数 vector 的罪恶。
- 弱智的占用内存。
- 弱智的释放内存。
- 弱智的常数极大。
- 弱智的地址乱飘。
- 弱智的内存扩容。
template<class Tp>
struct Vector {Tp *st, *ed;uint sz;inline uint size() { return sz; }inline void resize(uint SZ) { st = ed = new Tp[SZ]; sz = SZ; }inline bool empty() { return !sz; }inline void push(Tp p) { *ed++ = p; }Tp& operator [] (const uint a) { return st[a]; }
} ;