35 #ifndef NAV_GRID_INDEX_H 36 #define NAV_GRID_INDEX_H 46 template <
typename NumericType>
50 explicit GenericIndex(
const NumericType& x = 0,
const NumericType& y = 0) : x(x), y(y) {}
57 return x == other.
x && y == other.
y;
70 return x < other.
x || (x == other.
x && y < other.
y);
83 return "(" + std::to_string(x) +
", " + std::to_string(y) +
")";
87 template <
typename NumericType>
88 inline std::ostream& operator<<(std::ostream& stream, const GenericIndex<NumericType>& index)
90 stream << index.toString();
99 #endif // NAV_GRID_INDEX_H bool operator!=(const GenericIndex &other) const
bool operator>=(const GenericIndex &other) const
bool operator<=(const GenericIndex &other) const
bool operator==(const GenericIndex &other) const
comparison operator that requires equal x and y
A simple pair of x/y coordinates.
bool operator>(const GenericIndex &other) const
bool operator<(const GenericIndex &other) const
less than operator so object can be used in sets
std::string toString() const
String representation of this object.
GenericIndex(const NumericType &x=0, const NumericType &y=0)