Untitled

 avatar
unknown
c_cpp
5 months ago
340 B
5
Indexable
#ifndef PAIR_HASH_H__
#define PAIR_HASH_H__

#include <cstddef>
#include <iostream>
#include <utility>

struct pair_hash {
    template <class T1, class T2>
    std::size_t operator() (const std::pair<T1, T2>& pair) const {
        return std::hash<T1>()(pair.first) ^ (std::hash<T2>()(pair.second) << 1);
    }
};

#endif // PAIR_HASH_H__
Editor is loading...
Leave a Comment