@@ -44,17 +44,26 @@ typedef struct tag_vertex_type {
4444 std::int16_t x;
4545 std::int16_t y;
4646
47- bool operator ==(const tag_vertex_type& o) {
48- return (x == o.x ) && (y == o.y );
47+ // operators
48+ inline bool operator ==(const tag_vertex_type& rhs) const {
49+ return (x == rhs.x ) && (y == rhs.y );
4950 }
50- bool operator !=(const tag_vertex_type& o) {
51- return (x != o .x ) || (y != o .y );
51+ inline bool operator !=(const tag_vertex_type& rhs) const {
52+ return (x != rhs .x ) || (y != rhs .y );
5253 }
53- tag_vertex_type operator + (const tag_vertex_type& o) {
54- return { static_cast <std:: int16_t >(x + o. x ), static_cast <std:: int16_t >(y + o .y ) } ;
54+ inline bool operator < (const tag_vertex_type& rhs) const {
55+ return (y < rhs. y ) || ((y == rhs .y ) && (x < rhs. x )) ;
5556 }
56- tag_vertex_type operator -(const tag_vertex_type& o) {
57- return { static_cast <std::int16_t >(x - o.x ), static_cast <std::int16_t >(y - o.y ) };
57+ inline tag_vertex_type operator +(const tag_vertex_type& rhs) const {
58+ return { static_cast <std::int16_t >(x + rhs.x ), static_cast <std::int16_t >(y + rhs.y ) };
59+ }
60+ inline tag_vertex_type operator -(const tag_vertex_type& rhs) const {
61+ return { static_cast <std::int16_t >(x - rhs.x ), static_cast <std::int16_t >(y - rhs.y ) };
62+ }
63+ inline tag_vertex_type& operator +=(const tag_vertex_type& rhs) {
64+ x = static_cast <std::int16_t >(x + rhs.x );
65+ y = static_cast <std::int16_t >(y + rhs.y );
66+ return *this ;
5867 }
5968} vertex_type;
6069
0 commit comments