C++ Logo

std-proposals

Advanced search

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

From: Charles R Hogg <charles.r.hogg_at_[hidden]>
Date: Tue, 20 May 2025 08:32:40 -0400
On Tue, May 20, 2025 at 7:18 AM Gabriel Ravier via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 5/18/25 1:41 PM, Tymi via Std-Proposals wrote:
> > `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.
> >
> Did I miss something (and seemingly the entire internet, since Google
> returns no results for "meow_ordering") or is "meow_ordering" not a
> thing/referring to something else ?
>

I found this really confusing as well, and spent longer than I would care
to admit trying to google it. Eventually, I realized that "meow" is a cute
way of saying "foo" or "bar", and used the context clues around the `<=>`
operator to realize that they were likely referring to std::strong_ordering
<https://en.cppreference.com/w/cpp/utility/compare/strong_ordering>,
std::weak_ordering
<https://en.cppreference.com/w/cpp/utility/compare/weak_ordering>, and
std::partial_ordering
<https://en.cppreference.com/w/cpp/utility/compare/partial_ordering>.

Once I figured it out, I decided not to reply. But maybe that was a
mistake. If you found this confusing, and I found it confusing, then I'm
sure many other people on the list did too.


-- 
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-05-20 12:32:56