/** * File: built_in_hash.cpp * Created Time: 2023-06-21 * Author: krahets (krahets@163.com) */ #include "../utils/common.hpp" /* ドライバーコード */ int main() { int num = 3; size_t hashNum = hash()(num); cout << "The hash value of integer " << num << " is " << hashNum << "\n"; bool bol = true; size_t hashBol = hash()(bol); cout << "The hash value of boolean " << bol << " is " << hashBol << "\n"; double dec = 3.14159; size_t hashDec = hash()(dec); cout << "The hash value of decimal " << dec << " is " << hashDec << "\n"; string str = "Hello algorithm"; size_t hashStr = hash()(str); cout << "The hash value of string " << str << " is " << hashStr << "\n"; // C++では、組み込みのstd:hash()は基本データ型のハッシュ値のみを提供 // 配列やオブジェクトのハッシュ値計算は手動で実装する必要がある }