Warum kann ich eine Funktionsrückgabe 64bit int als Hasher übergeben?C++

Programme in C++. Entwicklerforum
Anonymous
 Warum kann ich eine Funktionsrückgabe 64bit int als Hasher übergeben?

Post by Anonymous »

#include
#include
#include

using namespace std;
class point
{
public:
float x, y;
point() = default;
point(float _x, float _y)
{
x = _x, y = _y;
}
};
struct hash_point
{
uint64_t operator()(const point& p) const
{
return uint64_t(p.x) + uint64_t(p.y);
}
};

bool operator==(const point& p, const point& q)
{
return p.x == q.x && p.y == q.y;
}
int main()
{
point p = { 3.0f,3.0f };
unordered_map m;
cout

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post