How to Emulate the Spaceship Operator Before C++20 with CRTP--Henrik Sjöström

Save to:
Instapaper Pocket Readability

To wait until the real thing.

How to Emulate the Spaceship Operator Before C++20 with CRTP

by Henrik Sjöström

From the article:

Making a class comparable is usually something of a chore. In C++20 we’ll get the “three-way comparison operator” or informally spaceship operator <=>. It will allow the compiler to create comparison operators when we want a simple lexicographical comparison and when we have a more complex comparison we only need to implement a single operator to be able to do all comparisons...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.