collate::hash
根據其 Facet 特定規則決定雜湊值序列。
long hash(
const CharType* _First,
const CharType* _Last
) const;
參數
_First
順序會決定對第一個字元的指標會有值。_Last
的序列要判斷到最後一個字元的指標會有值。
傳回值
雜湊值序列的型別 long 。
備註
成員函式會傳回 do_hash(_First, _Last)。
例如,雜湊值可以適用於發出序列 false 任意跨陣列清單。
範例
// collate_hash.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <tchar.h>
using namespace std;
int main( )
{
locale loc ( "German_germany" );
_TCHAR * s1 = _T("\x00dfzz abc."); // \x00df is the German sharp-s (looks like beta), it comes before z in the alphabet
_TCHAR * s2 = _T("zzz abc."); // \x00df is the German sharp-s (looks like beta), it comes before z in the alphabet
long r1 = use_facet< collate<_TCHAR> > ( loc ).
hash (s1, &s1[_tcslen( s1 )-1 ]);
long r2 = use_facet< collate<_TCHAR> > ( loc ).
hash (s2, &s2[_tcslen( s2 )-1 ] );
cout << r1 << " " << r2 << endl;
}
需求
標題: <地區設定>
命名空間: std