Created on 2014-02-01.00:00:00 last changed 98 months ago
Proposed resolution:
Modify Table 38 — Type property predicates for is_empty as follows:
T
is a class type, but not a union type,is a non-union class type with no non-static data membersother than, no unnamed bit-fields of non-zero length0, no virtual member functions, no virtual base classes, and no base class B for which is_empty_v<B> is false.
[ 2016-10 Telecon ]
Should probably point at section 1.8 for some of this. Status back to 'Open'
[ 2016-10 by Marshall - this PR incorrectly highlighted changed portions ]
Modify Table 38 — Type property predicates for is_empty as follows:
T is a non-union class type with no non-static data members
other than, no unnamed bit-fields of non-zero length0, no virtual member functions, no virtual base classes, and no base class B for which is_empty_v<B> is false.
[ 2016-08 Chicago ]
Walter says: We want is_empty_v<S> to produce false as a result. Therefore, we recommend adoption of the first of the issue's suggestions.
Tuesday AM: Moved to Tentatively Ready
Previous resolution [SUPERSEDED]:
The 'Condition' for std::is_empty is listed as:
"T is a class type, but not a union type, with no non-static data members other than bit-fields of length 0, no virtual member functions, no virtual base classes, and no base class B for which is_empty<B>::value is false."
This is incorrect: there is no such thing as a non-static data member that is a bit-field of length 0, since bit-fields of length 0 must be unnamed, and unnamed bit-fields are not members (see [class.bit] p2).
It also means that classes such as:struct S { int : 3; };
are empty (because they have no non-static data members). There's implementation divergence on the value of is_empty<S>::value.
I'm not sure what the purpose of is_empty is (or how it could be useful), but if it's desirable for the above type to not be treated as empty, something like this could work:"T is a class type, but not a union type, with no non-static data members
other than, no unnamed bit-fields of non-zero length0, no virtual member functions, no virtual base classes, and no base class B for which is_empty<B>::value is false."
and if the above type should be treated as empty, then this might be appropriate:
"T is a class type, but not a union type, with no (named) non-static data members
other than bit-fields of length 0, no virtual member functions, no virtual base classes, and no base class B for which is_empty<B>::value is false."
History | |||
---|---|---|---|
Date | User | Action | Args |
2016-10-10 20:46:47 | admin | set | messages: + msg8551 |
2016-10-10 20:46:47 | admin | set | status: ready -> open |
2016-10-05 22:21:09 | admin | set | messages: + msg8538 |
2016-08-02 17:30:37 | admin | set | status: new -> ready |
2016-08-02 13:14:37 | admin | set | messages: + msg8305 |
2016-08-02 13:14:37 | admin | set | messages: + msg8304 |
2014-02-01 00:00:00 | admin | create |