Compartilhar via


owner_less

Allows ownership-based mixed comparisons of shared and weak pointers. Returns true if the left parameter is ordered before right parameter by the member function owner_before.

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
);
};

Parameters

  • _left
    A shared or weak pointer.

  • _Right
    A shared or weak pointer.

Property Value/Return Value

Returns true if _Left is ordered before _Right by the member function owner_before.

Remarks

The template classes define all their member operators as returning _Left.owner_before(_Right).

Requirements

Header: <memory>

Namespace: std

See Also

Reference

shared_ptr::owner_before

weak_ptr::owner_before

<memory>