-
Notifications
You must be signed in to change notification settings - Fork 4
/
Point.h
50 lines (40 loc) · 1.04 KB
/
Point.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Point.h
// Fission
//
// Created by C0deH4cker on 2/23/14.
// Copyright (c) 2014 C0deH4cker. All rights reserved.
//
#ifndef FSN_POINT_H
#define FSN_POINT_H
#include <ostream>
namespace fsn {
struct Point {
int x;
int y;
size_t hash() const;
};
bool operator==(const Point& a, const Point& b);
bool operator!=(const Point& a, const Point& b);
/*!
Compares two points. A point is less than another if its y coordinate is
smaller. If both points have the same y coordinate, the one with the
smaller x coordinate is chosen as the smaller point.
*/
bool operator<(const Point& a, const Point& b);
bool operator<=(const Point& a, const Point& b);
bool operator>(const Point& a, const Point& b);
bool operator>=(const Point& a, const Point& b);
// Used for printing debug information
std::ostream& operator<<(std::ostream& os, Point pt);
}
// Allow std::hash<Point>
namespace std {
template<>
struct hash<fsn::Point> {
size_t operator()(fsn::Point pt) const {
return pt.hash();
}
};
}
#endif /* FSN_POINT_H */