Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 1.3 KB

File metadata and controls

58 lines (43 loc) · 1.3 KB

wmemcmp

  • cwchar[meta header]
  • std[meta namespace]
  • function[meta id-type]
namespace std {
  int wmemcmp(const wchar_t* s1, const wchar_t* s2, size_t n);
}
  • size_t[link /reference/cstddef/size_t.md]

概要

指定した文字数のワイド文字を比較する。

戻り値

先頭からn文字を比較し、s1がs2より大きい場合は正の値、等しい場合は0、小さい場合は負の値を返す。

備考

  • ヌル文字も通常の文字として比較される
  • この関数は、C++26からフリースタンディング処理系でも使用できる

例

#include <cwchar>
#include <iostream>

int main()
{
  std::wcout << (std::wmemcmp(L"abc", L"abd", 2) == 0) << std::endl;
  std::wcout << (std::wmemcmp(L"abc", L"abd", 3) < 0) << std::endl;
}
  • std::wmemcmp[color ff0000]
  • std::wcout[link /reference/iostream/wcout.md]

出力

1
1

バージョン

言語

  • C++98

関連項目

参照