collate::hash
根据他们的特定规则方面确定序列哈希值。
long hash(
const CharType* _First,
const CharType* _Last
) const;
参数
_First
序列中将定位到第一个字符的指针。具有值。_Last
的顺序将确定为最后一个字符的指针。具有值。
返回值
类型 long 哈希值的序列。
备注
成员函数返回 do_hash(_First,_Last)。
例如,因此哈希值很有用。分发序列假任意一个列表中。
示例
// 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