最終更新日時(UTC): 2026年02月17日 14時22分33秒
Akira Takahashi が更新

履歴 編集

function template
<stack>

std::operator<=

namespace std {
  template <class T, class Container>
  bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);           // (1) C++03
  template <class T, class Container>
  constexpr bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y); // (1) C++26
}

概要

stack において、左辺が右辺以下かを判定する。

戻り値

x.c <= y.c

#include <iostream>
#include <stack>

int main()
{
  std::stack<int> x;
  x.push(2);
  x.push(7);
  x.push(1);

  std::stack<int> y;
  y.push(3);
  y.push(1);
  y.push(4);

  std::cout << std::boolalpha << (x <= y) << std::endl;
}

出力

true

参照

Morty Proxy This is a proxified and sanitized view of the page, visit original site.