N4126: Explicitly defaulted comparison operators -- Oleg Smolsky

A new WG21 paper is available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4126

Date: 2014-07-29

Explicitly defaulted comparison operators

by Oleg Smolsky

Excerpt:

N3950 was presented to the Evolution WG at the Rapperswil meeting and the response was very positive. A later revision, N4114 was amended to handle the following points requested at the meeting:

  • Support for non-member operators
  • Mutable members: there was consensus on their treatment. The compromise is to to make explicitly defaulted operators ill-formed when mutable members are present. See "Mutable members".
  • Short-hand notation was proposed and had very positive feedback. See "The proposed syntax: short form".

This proposal makes the following changes after the technical review on the c++std-ext list:

  • Pointer, floating point and enumerated type members are included. See "Domain of the operator functions" for the discussion.
  • Each explicitly defaulted operator is independent and is bridged to the respective members' operators
  • Lexicographical comparison is defined explicitly

Add a Comment

Comments are closed.

Comments (1)

0 0

Andrzej Krzemienski said on Aug 6, 2014 04:19 AM:

Interesting, the specification of default-generated operator== does not say what value it should return. It looks like a conforming (but malicious) implementation could generate one that always returns false.