operator<= |
C++ Library |
template<class T, class Cont> bool operator<=(const queue<T, Cont>&q1, const queue<T, Cont>&q2) ;
Returns true if !(q1 > q2).
#include <iostream> #include <queue> int main() { std::queue<int> q1, q2, q3, q4 ; int i ; for (i = 0; i < 10; i++) { q1.push(i) ; q2.push(i*i) ; q3.push(i*i*i) ; q4.push(i) ; } if (q1 == q4) std::cout << "q1 == q4" << std::endl ; if (q2 != q3) std::cout << "q2 != q3" << std::endl ; if(q2 < q3) std::cout << "q2 < q3" << std::endl ; if(q3 > q2) std::cout << "q3 > q2" << std::endl ; q4.push(29) ; if (q1 <= q4) std::cout << "after q4.push(29), q1 <= q4" << std::endl ; if (q3 >= q2) std::cout << "q3 >= q2" << std::endl ; return 0 ; }
q1 == q4 q2 != q3 q2 < q3 q3 > q2 after q4.push(29), q1 <= q4 q3 >= q2