blob: 1a210cbdeac33138d37751ba7cc58f4c561cb585 (
plain)
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
|
#ifndef LOCATION_HH
#define LOCATION_HH
#include <compare>
#include <cstdint>
#include <iosfwd>
namespace src {
struct Location {
uint64_t line;
uint16_t column;
constexpr Location() : line(0), column(0) {}
Location(uint64_t line, uint16_t column) : line(line), column(column) {}
[[nodiscard]]
std::strong_ordering operator<=>(Location const& loc) const {
auto ret = line <=> loc.line;
if (ret == std::strong_ordering::equal)
return column <=> loc.column;
return ret;
}
};
std::ostream& operator<<(std::ostream& out, Location const& loc);
} // namespace src
#endif // LOCATION_HH
|