operators (std::list)
template< class T, class Alloc > bool operator==( const list<T,Alloc>& lhs, const list<T,Alloc>& rhs ); | (1) | |
---|---|---|
template< class T, class Alloc > bool operator!=( const list<T,Alloc>& lhs, const list<T,Alloc>& rhs ); | (2) | |
template< class T, class Alloc > bool operator<( const list<T,Alloc>& lhs, const list<T,Alloc>& rhs ); | (3) | |
template< class T, class Alloc > bool operator<=( const list<T,Alloc>& lhs, const list<T,Alloc>& rhs ); | (4) | |
template< class T, class Alloc > bool operator>( const list<T,Alloc>& lhs, const list<T,Alloc>& rhs ); | (5) | |
template< class T, class Alloc > bool operator>=( const list<T,Alloc>& lhs, const list<T,Alloc>& rhs ); | (6) | |
比较两个容器的内容。
1-2%29检查lhs
和rhs
是平等的,也就是说,无论lhs.size() == rhs.size()
每一个元素lhs
中的元素相等。rhs
在同一位置。
3-6%29比较lhs
和rhs
按字典顺序。比较由一个相当于std::lexicographical_compare
...
参数
lhs, rhs | - | containers whose contents to compare |
---|
-T必须满足“公平比较”的要求,才能使用过载%281-2%29。
T必须满足LessThanable的要求,才能使用过载%283-6%29。订货关系必须建立总秩序。
返回值
1%29true
如果容器的内容相等,false
不然的话
2%29true
如果容器的内容不相等,false
不然的话
3%29true
如果lhs
按字典顺序再少点比…的内容rhs
,,,false
不然的话
4%29true
如果lhs
按字典顺序再少点比或平等...的内容rhs
,,,false
不然的话
5%29true
如果lhs
按字典顺序更大比…的内容rhs
,,,false
不然的话
6%29true
如果lhs
按字典顺序更大比或平等...的内容rhs
,,,false
不然的话
复杂性
容器的大小成线性。
© cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com