如何将单独的派生类指针与单独的基类指针进行比较?

时间:2014-11-23 05:06:05

标签: c++ pointers shared-ptr

如果我有两个课程,例如:

    class Base : boost::noncopyable {
    using ptr_type = std::shared_ptr<Base>;
    }

    class DerivedOne : public Base{    
    using ptr_type = std::shared_ptr<DerivedOne>;
    }

    class DerivedTwo : public SomeOtherBase{
    using ptr_type = std::shared_ptr<DerivedTwo>;
    }

如果我想使用下面指定的用法,我如何将DerivedOne::ptr_typeDerivedTwo::ptr_typeBase::ptr_type进行比较?有没有办法做到这一点,就好像将DerivedOneDerivedTwoBase进行比较?我的首选用法是:

if(DerivedOne::ptr_type == Base::ptr_type)应该返回true。

由于

0 个答案:

没有答案