Common Library  0.9.5
EqStr 構造体

文字列等号比較用関数オブジェクト [詳解]

std::binary_function< std::string, std::string, bool >を継承しています。

公開メンバ関数

 EqStr (bool nCase=false)
 大文字・小文字を無視するかを指定して構築 [詳解]
 
bool operator() (const std::string &s1, const std::string &s2) const
 二つの文字列が等しければ true を返す [詳解]
 

フィールド

bool ignoreCase
 大文字・小文字を無視するなら true にする
 

詳解

文字列等号比較用関数オブジェクト

アルゴリズムで利用することを想定している。 例えば、大文字・小文字を無視した上で二つのシーケンスの文字列を比較したい場合は次のようにすればよい。

std::vector< std::string > str1;
std::vector< std::string > str2;
:
// シーケンスの内容が一致したら true を返す
bool res = std::equal( str1.begin(), str1.end(), str2.begin(), EqStr( true ) );
文字列等号比較用関数オブジェクト
Definition: gadget.h:190

構築子と解体子

◆ EqStr()

EqStr::EqStr ( bool  nCase = false)
inline

大文字・小文字を無視するかを指定して構築

引数
nCase大文字・小文字を無視するなら true にする

関数詳解

◆ operator()()

bool EqStr::operator() ( const std::string &  s1,
const std::string &  s2 
) const
inline

二つの文字列が等しければ true を返す

引数
s1比較対象文字列 1
s2比較対象文字列 2
戻り値
s1 = s2 なら true を返す

この構造体詳解は次のファイルから抽出されました: