Moule Lin
← All notes

P22: Member Templates

A template inside a template, usually used in constructors,

// for smart pointer
template<class _Tp>
class shared_pte:public _shared_ptr<_Tp>{

    ...
    template<class _Tp1>
    explicit shared_ptr(const _Tp1* _p):_shared_ptr<_Tp>(_p){}
}
shared_ptr<Base1>sptr(new Derived1);