- string[meta header]
- std[meta namespace]
- char_traits[meta class]
- function[meta id-type]
static bool eq(const char_type& c1, const char_type& c2); // C++03
static constexpr bool eq(char_type c1, char_type c2) noexcept; // C++11
2つの文字を比較し、同じかどうかを判定する。
標準で定義されるchar_traits
の特殊化では、c1 == c2
の結果を返す。
定数時間
#include <iostream>
#include <string>
int main()
{
if (std::char_traits<char>::eq('a', 'a')) {
std::cout << "equal" << std::endl;
}
else {
std::cout << "not equal" << std::endl;
}
}
- eq[color ff0000]
equal