collate::hash
가 면 관련 규칙에 따라 시퀀스의 해시 값을 결정합니다.
long hash(
const CharType* _First,
const CharType* _Last
) const;
매개 변수
_First
시퀀스의 값이 첫 번째 문자에 대 한 포인터 결정 될 수 있습니다._Last
포인터의 값이 시퀀스의 마지막 문자에 따라 결정입니다.
반환 값
해시 값의 형식 긴 시퀀스.
설명
멤버 함수를 반환 합니다. do_hash(_First, _Last).
해시 값은 시퀀스 pseudo-randomly 배열을 목록 전체를 배포 예를 들어,에서 유용할 수 있습니다.
예제
// 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;
}
요구 사항
헤더: <locale>
네임 스페이스: std