共用方式為


operator< (<memory>)

Tests for one object being less than a second object.

template<class Type1, class Del1, class Type2, class Del2>
    bool operator<(
        const unique_ptr<Type1, Del1>& _Left,
        const unique_ptr<Type2&, Del2>& _Right
    );
template<class Ty1, class Ty2>
    bool operator<(
        const shared_ptr<Ty1>& _Left,
        const shared_ptr<Ty2>& _Right
    );

Parameters

  • _Left
    One of the objects to be compared.

  • _Right
    One of the objects to be compared.

  • Ty1
    The type controlled by the left pointer.

  • Ty2
    The type controlled by the right pointer.

Property Value/Return Value

Returns _Left.get() < _Right.get().

Requirements

Header: <memory>

Namespace: std

See Also

Reference

<memory>

shared_ptr Class

unique_ptr Class

Other Resources

<memory> Members

shared_ptr::operator<

unique_ptr Members

Change History

Date

History

Reason

January 2011

Support for an "operator<" that takes "const weak_ptr" parameters was removed from the C++ Standard.

Information enhancement.

August 2010

Added TR1 extensions information.

Information enhancement.