最終更新日時:
が更新

履歴 編集

function
<string>

std::operator<=

namespace std {
  template <class CharT, class Traits, class Allocator>
  bool operator<=(const basic_string<CharT, Traits, Allocator>& a,
                  const basic_string<CharT, Traits, Allocator>& b) noexcept; // (1)

  template <class CharT, class Traits, class Allocator>
  bool operator<=(const CharT* a,
                  const basic_string<CharT, Traits, Allocator>& b) noexcept; // (2)

  template <class CharT, class Traits, class Allocator>
  bool operator<=(const basic_string<CharT, Traits, Allocator>& a,
                  const CharT* rhs) noexcept;                                // (3)
}

概要

basic_stringにおいて、左辺が右辺以下かの判定を行う。

戻り値

#include <iostream>
#include <string>

int main()
{
  std::string a = "aaa";
  std::string b = "bbb";

  std::cout << std::boolalpha;
  std::cout << (a <= b) << std::endl;
}

出力

true

参照