removed .orig files (astyle backups)
This commit is contained in:
@ -5,43 +5,43 @@ position::position(): x{0}, y{0} {}
|
||||
position::position(int nx, int ny): x{nx}, y{ny} {}
|
||||
|
||||
position position::operator+(const position &other) const {
|
||||
position result{x + other.x, y + other.y};
|
||||
return result;
|
||||
position result{x + other.x, y + other.y};
|
||||
return result;
|
||||
}
|
||||
|
||||
position &position::operator=(const position &other) {
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
return *this;
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
position &position::operator+=(const position &other) {
|
||||
return *this = *this + other;
|
||||
return *this = *this + other;
|
||||
}
|
||||
|
||||
bool position::operator==(const position &other) const {
|
||||
return x == other.x && y == other.y;
|
||||
return x == other.x && y == other.y;
|
||||
}
|
||||
|
||||
bool position::operator!=(const position &other) const {
|
||||
return x != other.x || y != other.y;
|
||||
return x != other.x || y != other.y;
|
||||
}
|
||||
|
||||
bool position::operator<(const position &other) const {
|
||||
return y < other.y || x < other.x;
|
||||
return y < other.y || x < other.x;
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
|
||||
size_t find(const std::vector<position> &sorted_list,
|
||||
const position &target) {
|
||||
// TODO: implement binary searching
|
||||
// TODO: implement binary searching
|
||||
|
||||
for (size_t i = 0; i < sorted_list.size(); ++i)
|
||||
if (sorted_list[i] == target)
|
||||
return i;
|
||||
for (size_t i = 0; i < sorted_list.size(); ++i)
|
||||
if (sorted_list[i] == target)
|
||||
return i;
|
||||
|
||||
return sorted_list.size();
|
||||
return sorted_list.size();
|
||||
}
|
||||
|
||||
#include <algorithm>
|
||||
|
Reference in New Issue
Block a user