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. system_error
  3. error_code
  4. operator<

最終更新日時: 2026年09月19日 21時31分51秒 (JST)
rotarymars が更新

履歴 編集

function
<system_error>

std::operator<(C++11)

namespace std {
  // operator<=>により、以下の演算子が使用可能になる (C++20)
  bool
    operator<(const error_code& lhs,
              const error_code& rhs) noexcept; // (1) C++11
}

概要

error_codeにおいて、左辺が右辺より小さいかの比較を行う。

戻り値

return lhs.category() < rhs.category() || lhs.category() == rhs.category() && lhs.value() < rhs.value();

例外

投げない

例

#include <iostream>
#include <system_error>

int main()
{
  std::error_code ec1 = std::make_error_code(std::errc::invalid_argument);
  std::error_code ec2 = std::make_error_code(std::errc::permission_denied);

  std::cout << std::boolalpha;
  std::cout << (ec1 < ec2) << std::endl;
}

出力

false

バージョン

言語

  • C++11

処理系

  • Clang: 9.0.1 ✅
  • GCC: 4.7.0 ✅
  • Visual C++: 2010 ✅
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.