From cppreference.com
template<classT,classContainer>booloperator==(conststd::stack<T,Container>&lhs,conststd::stack<T,Container>&rhs); (1) template<classT,classContainer>booloperator!=(conststd::stack<T,Container>&lhs,conststd::stack<T,Container>&rhs); (2) template<classT,classContainer>booloperator<(conststd::stack<T,Container>&lhs,conststd::stack<T,Container>&rhs); (3) template<classT,classContainer>booloperator<=(conststd::stack<T,Container>&lhs,conststd::stack<T,Container>&rhs); (4) template<classT,classContainer>booloperator>(conststd::stack<T,Container>&lhs,conststd::stack<T,Container>&rhs); (5) template<classT,classContainer>booloperator>=(conststd::stack<T,Container>&lhs,conststd::stack<T,Container>&rhs); (6) template<classT,std::three_way_comparableContainer>std::compare_three_way_result_t<Container>operator<=>(conststd::stack<T,Container>&lhs,conststd::stack<T,Container>&rhs); (7) (since C++20)Compares the contents of the underlying containers of two container adaptors. The comparison is done by applying the corresponding operator to the underlying containers.
Parameters
lhs, rhs - container adaptors whose contents to compare -T must meet the requirements of
. Return value
1-6)true if the corresponding comparison yields true, false otherwise.
7) Result of three-way comparison on underlying containers.
Complexity
Linear in the size of the container.
Example
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior
C++98 the semantics of all comparison operators were missing added