owner_less

允许对共享的和弱的指针进行基于所有权的混合比较。 如果的参数由成员函数 owner_before之前,顺序,在正确的参数返回 true。

template<class Type>
    struct owner_less; // not defined

template<class Type>
    struct owner_less<shared_ptr<Type> > {
    bool operator()(
        const shared_ptr<Type>& _Left,
        const shared_ptr<Type>& _Right
);
    bool operator()(
        const shared_ptr<Type>& _Left,
        const weak_ptr<Type>& _Right
);
    bool operator()(
        const weak_ptr<Type>& _Left,
        const shared_ptr<Type>& _Right
);
};

template<class Type>
    struct owner_less<weak_ptr<Type> >
    bool operator()(
        const weak_ptr<Type>& _Left,
        const weak_ptr<Type>& _Right
);
    bool operator()(
        const weak_ptr<Type>& _Left,
        const shared_ptr<Ty>& _Right
);
    bool operator()(
        const shared_ptr<Type>& _Left,
        const weak_ptr<Type>& _Right
);
};

参数

  • _left
    共享或弱指针。

  • _Right
    共享或弱指针。

属性值/返回值

如果 _Left 由成员函数 owner_before之前,排序,则 _Right 返回 true。

备注

模板类定义它们的所有成员运算符为返回 _Left.owner_before(_Right)。

要求

页眉: <内存>

命名空间: std

请参见

参考

shared_ptr::owner_before

weak_ptr::owner_before

<memory>