GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cpprefjp - C++日本語リファレンス
  • GitHub Project

This view

  • Original page
  • New address

GeezerVison is showing cpprefjp.github.io — std::operator< - cpprefjp C++日本語リファレンス

  1. リファレンス
  2. stack
  3. stack
  4. operator<

最終更新日時: 2026年08月25日 12時11分17秒 (JST)
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++98
  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

参照

  • P3372R3 constexpr containers and adaptors
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.