vector是怎么实现的??
我在编程代码中见到类似这样的定义:typedef std::vector<XQQuery*, XQillaAllocator<XQQuery*> > ImportedModules;查找其定义找到一个vector文件
template<class _Ty,
class _Ax>
class vector
: public _Vector_val<_Ty, _Ax>
{ // varying size array of values
public:
typedef vector<_Ty, _Ax> _Myt;
typedef _Vector_val<_Ty, _Ax> _Mybase;
typedef typename _Mybase::_Alty _Alloc;
typedef _Alloc allocator_type;
typedef typename _Alloc::size_type size_type;
typedef typename _Alloc::difference_type _Dift;
typedef _Dift difference_type;
typedef typename _Alloc::pointer _Tptr;
typedef typename _Alloc::const_pointer _Ctptr;
typedef _Tptr pointer;
typedef _Ctptr const_pointer;
typedef typename _Alloc::reference _Reft;
typedef _Reft reference;
typedef typename _Alloc::const_reference const_reference;
typedef typename _Alloc::value_type value_type;
#define _VEC_ITER_BASE(it) (it)._Myptr
这只是一部分代码,我想问的是,此时的vector和STL中的vector一样吗?STL中vector一般都是形如vector<int>或vector< vector<int> >,这里的vector是怎么回事??是不是也可以有vector<int,int>,STL中的容器自己也可以起同样的名字对其重新定义吗?上面vector的形式在后面的代码中也用到了iterator迭代器,若是自己重新定义一个vector也可以用iterator来遍历?