Modernes C++ programmieren

Okt 20, 2024

lst-0117-godb.cpp

//#(compile) c++; compiler:g141; options:-O0 -std=c++23; libs:-
// https://godbolt.org/z/cveT8Ej7q
struct EqEntry {
    bool operator()(const Entry&a, const Entry&b) const {
        return a.city_==b.city_;
    }
};

struct HashEntry {
    std::hash<string> sHash;
    std::hash<int> iHash;
    size_t operator()(const Entry& a) const {
        return sHash(a.city_) ^ iHash(a.zip_); // (ERR) too many elements
    }
};