GCC 10's C++20 "Spaceship Operator" Support Appears To Be In Good Shape

Written by Michael Larabel in GNU on 6 December 2019 at 01:39 AM EST. 30 Comments
GNU
One of the prominent additions coming with the C++20 programming language is the consistent comparison operator, or "spaceship operator" as it's commonly referred to. The support was merged for GCC 10 last month ahead of entering stage three development while this week some more improvements were made to the implementation.

The C++20 spaceship operator allows for easily performing a three-way comparison as a single operation. The behavior and syntax is the same as found in PHP7 and other programming languages with <=>.

The C++20 spaceship operator support was merged in early November for GCC 10. The commits this week meanwhile allow the operator to be used with std::pair and std::array, among other related commits in recent weeks.

See the GCC C++ status page for the state of C++20/C++2A with GCC 10. Most C++20 functionality is already in place even on GCC 8/9 but some pieces remain around atomic compare-and-exchange with padding bits, modules support, coroutines, using enum, and more implicit moves.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week