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