C++ Logo

std-proposals

Advanced search

[std-proposals] Allow switch for std::meow_ordering

From: Tymi <tymi.cpp_at_[hidden]>
Date: Sun, 18 May 2025 13:41:49 +0200
`switch (left <=> right)` would be a nice thing to have not only for
stylistic reasons, but could also be an easy way for the compiler to form a
jump table, and be less bug prone than a chain of if/else

It would require a small core language change, mainly explicitly allowing
std::meow_ordering in switch expressions, I said small because
meow_ordering has an exposition only non static data member integral value
for the comparison. Not sure about the wording though, that might be the
difficult part

Tymi.

Received on 2025-05-18 11:42:00