此处是从GCC STL位/stl_vector.h复制的
template<typename _Tp, typename _Alloc>
struct _Vector_base
{
typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template
rebind<_Tp>::other _Tp_alloc_type;
typedef typename __gnu_cxx::__alloc_traits<_Tp_alloc_type>::pointer
pointer;
struct _Vector_impl
: public _Tp_alloc_type
{
pointer _M_start;
pointer _M_finish;
pointer _M_end_of_storage;
_Vector_impl()
: _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{ }我想知道_Tp_alloc_type()是什么意思?_Tp_alloc_type是一种类型,定义为
typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template
rebind<_Tp>::other _Tp_alloc_type;发布于 2017-02-02 02:10:47
我想知道_Tp_alloc_type()是什么意思?
正如您在以下代码中所看到的:
struct _Vector_impl
: public _Tp_alloc_type_Vector_impl是从_Tp_alloc_type继承的,因此代码如下:
_Vector_impl()
: _Tp_alloc_type() ...方法:通过基类_Tp_alloc_type的默认ctor初始化它
https://stackoverflow.com/questions/41986187
复制相似问题