| (1) | template <class T, class Alloc> bool operator== (const deque<T,Alloc>& lhs, const deque<T,Alloc>& rhs); |
| (2) | template <class T, class Alloc> bool operator!= (const deque<T,Alloc>& lhs, const deque<T,Alloc>& rhs); |
| (3) | template <class T, class Alloc> bool operator< (const deque<T,Alloc>& lhs, const deque<T,Alloc>& rhs); |
| (4) | template <class T, class Alloc> bool operator<= (const deque<T,Alloc>& lhs, const deque<T,Alloc>& rhs); |
| (5) | template <class T, class Alloc> bool operator> (const deque<T,Alloc>& lhs, const deque<T,Alloc>& rhs); |
| (6) | template <class T, class Alloc> bool operator>= (const deque<T,Alloc>& lhs, const deque<T,Alloc>& rhs); |
| 操作符 | 等价操作 |
| a!=b | !(a==b) |
| a>b | b<a |
| a<=b | !(b<a) |
| a>=b | !(a<b) |
// deque comparisons
#include <iostream>
#include <deque>
int main ()
{
std::deque<int> foo (3,100); // three ints with a value of 100
std::deque<int> bar (2,200); // two ints with a value of 200
if (foo==bar) std::cout << "foo and bar are equal\n";
if (foo!=bar) std::cout << "foo and bar are not equal\n";
if (foo< bar) std::cout << "foo is less than bar\n";
if (foo> bar) std::cout << "foo is greater than bar\n";
if (foo<=bar) std::cout << "foo is less than or equal to bar\n";
if (foo>=bar) std::cout << "foo is greater than or equal to bar\n";
return 0;
} |
| deque::operator= | 分配的内容(公众成员函数) |
| deque::swap | 交换内容(公众成员函数) |