Replace std::strong_ordering with auto return type to not require <compare>

This commit is contained in:
Maxime Coste 2023-01-21 11:19:39 +11:00
parent c0be723444
commit 702358b559
5 changed files with 5 additions and 6 deletions

View File

@ -34,7 +34,7 @@ linux_task:
macos_task: macos_task:
macos_instance: macos_instance:
image: ventura-base image: ghcr.io/cirruslabs/macos-ventura-base:latest
matrix: matrix:
- name: macos_clang - name: macos_clang
clang_script: brew install llvm@11 clang_script: brew install llvm@11

View File

@ -68,7 +68,7 @@ public:
BufferIterator(const Buffer& buffer, BufferCoord coord) noexcept; BufferIterator(const Buffer& buffer, BufferCoord coord) noexcept;
bool operator== (const BufferIterator& iterator) const noexcept; bool operator== (const BufferIterator& iterator) const noexcept;
std::strong_ordering operator<=>(const BufferIterator& iterator) const noexcept; auto operator<=>(const BufferIterator& iterator) const noexcept;
bool operator== (const BufferCoord& coord) const noexcept; bool operator== (const BufferCoord& coord) const noexcept;
const char& operator* () const noexcept; const char& operator* () const noexcept;

View File

@ -108,7 +108,7 @@ inline bool BufferIterator::operator==(const BufferIterator& iterator) const noe
return m_coord == iterator.m_coord; return m_coord == iterator.m_coord;
} }
inline std::strong_ordering BufferIterator::operator<=>(const BufferIterator& iterator) const noexcept inline auto BufferIterator::operator<=>(const BufferIterator& iterator) const noexcept
{ {
kak_assert(m_buffer == iterator.m_buffer); kak_assert(m_buffer == iterator.m_buffer);
return (m_coord <=> iterator.m_coord); return (m_coord <=> iterator.m_coord);

View File

@ -85,7 +85,7 @@ struct Key
constexpr uint64_t val() const { return (uint64_t)modifiers << 32 | key; } constexpr uint64_t val() const { return (uint64_t)modifiers << 32 | key; }
constexpr bool operator==(Key other) const { return val() == other.val(); } constexpr bool operator==(Key other) const { return val() == other.val(); }
constexpr std::strong_ordering operator<=>(Key other) const { return val() <=> other.val(); } constexpr auto operator<=>(Key other) const { return val() <=> other.val(); }
constexpr DisplayCoord coord() const { return {(int)((key & 0xFFFF0000) >> 16), (int)(key & 0x0000FFFF)}; } constexpr DisplayCoord coord() const { return {(int)((key & 0xFFFF0000) >> 16), (int)(key & 0x0000FFFF)}; }
constexpr MouseButton mouse_button() { return MouseButton{((int)modifiers & (int)Modifiers::MouseButtonMask) >> 6}; } constexpr MouseButton mouse_button() { return MouseButton{((int)modifiers & (int)Modifiers::MouseButtonMask) >> 6}; }

View File

@ -1092,8 +1092,7 @@ int main(int argc, char* argv[])
try try
{ {
auto show_usage = [&]() auto show_usage = [&]() {
{
write_stdout(format("Usage: {} [options] [file]... [+<line>[:<col>]|+:]\n\n" write_stdout(format("Usage: {} [options] [file]... [+<line>[:<col>]|+:]\n\n"
"Options:\n" "Options:\n"
"{}\n" "{}\n"