Issue 2567: Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits
and BinaryTypeTraits (original) (raw)
This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
2567. Specification of logical operator traits uses BaseCharacteristic
, which is defined only for UnaryTypeTraits
and BinaryTypeTraits
Section: 21.3.9 [meta.logical] Status: C++17 Submitter: Tim Song Opened: 2015-12-10 Last modified: 2017-07-30
Priority: 2
View all other issues in [meta.logical].
View all issues with C++17 status.
Discussion:
The specification of conjunction
and disjunction
uses the term BaseCharacteristic
, which is problematic in several ways:
- That term is defined in 21.3.2 [meta.rqmts], but only for
UnaryTypeTraits
andBinaryTypeTraits
.conjunction
anddisjunction
seem to be neither. - 21.3.2 [meta.rqmts] also requires the
BaseCharacteristic
for bothUnaryTypeTraits
andBinaryTypeTraits
to be a specialization ofintegral_constant
, which is inconsistent with the current design ofconjunction
anddisjunction
. - The requirement in 21.3.2 [meta.rqmts] that "member names of the
BaseCharacteristic
shall not be hidden and shall be unambiguously available" seems impossible to meet in every case, since the arbitrary base class from which a specialization ofconjunction
ordisjunction
derives may contain members calledconjunction
ordisjunction
that will necessarily be hidden.
[2016-08 Chicago]
Ville provided wording for both 2567(i) and 2568(i)
Previous resolution [SUPERSEDED]:
In [meta.logical]/3, edit as follows:
The
BaseCharacteristic of aspecializationconjunction<B1, ..., BN>
has a public and unambiguous base thatis the first typeBi
in the listtrue_type, B1, ..., BN
for whichBi::value == false
, or if everyBi::value != false
, theaforementioned baseBaseCharacteristicis the last type in the list. [ Note: This means a specialization of conjunction does not necessarilyhave a BaseCharacteristic ofderive from either true_type or false_type. — end note ]In [meta.logical]/6, edit as follows:
The
BaseCharacteristic of aspecializationdisjunction<B1, ..., BN>
has a public and unambiguous base thatis the first typeBi
in the listfalse_type, B1, ..., BN
for whichBi::value != false
, or if everyBi::value == false
, theaforementioned baseBaseCharacteristicis the last type in the list. [ Note: This means a specialization of disjunction does not necessarilyhave a BaseCharacteristic ofderive from either true_type or false_type. — end note ]
Previous resolution [SUPERSEDED]:
In [meta.logical]/3, edit as follows:
The
BaseCharacteristic of aspecializationconjunction<B1, ..., BN>
has a public and unambiguous base that is either
* the first typeBi
in the listtrue_type, B1, ..., BN
for whichBi::value == false
, or
* if there is no suchBi
, the last type in the list.is the first typeBi
in the listtrue_type, B1, ..., BN
for whichBi::value == false
, or if everyBi::value != false
, the BaseCharacteristic is the last type in the list.
[ Note: This means a specialization ofconjunction
does not necessarilyhave a BaseCharacteristic ofderive from either true_type or false_type. — end note ]In [meta.logical]/6, edit as follows:
The
BaseCharacteristic of aspecializationdisjunction<B1, ..., BN>
has a public and unambiguous base that is either
* the first typeBi
in the listtrue_type, B1, ..., BN
for whichBi::value != false
, or
* if there is no suchBi
, the last type in the list.is the first typeBi
in the listtrue_type, B1, ..., BN
for whichBi::value != false
, or if everyBi::value == false
, the BaseCharacteristic is the last type in the list.
[ Note: This means a specialization ofdisjunction
does not necessarilyhave a BaseCharacteristic ofderive from either true_type or false_type. — end note ]
Merged the resolution of [2587](lwg-defects.html#2587 ""Convertible to bool" requirement in conjunction and disjunction (Status: C++17)")(i) with this issue. This proposed resolution resolves both, and includes fixes from Daniel for negation. Last review of this with LWG turned up a true_type typo in the definition of disjunction, and some editorial changes.
Previous resolution [SUPERSEDED]:
This wording is relative to N4606.
- In 21.3.9 [meta.logical] p3, edit as follows:
template<class... B> struct conjunction : see below { };-3- The
BaseCharacteristic of aspecializationconjunction<B1, ..., BN>
has a public and unambiguous base that is either
- the first type
Bi
in the listtrue_type, B1, ..., BN
for whichbool(Bi::value)
isfalse
, or- if there is no such
Bi
, the last type in the list.is the first typeBi
in the listtrue_type, B1, ..., BN
for whichBi::value == false
, or if everyBi::value != false
, the BaseCharacteristic is the last type in the list.-?- The member names of the base class, other than
conjunction
andoperator=
, shall not be hidden and shall be unambiguously available inconjunction
. [Note: This means a specialization ofconjunction
does not necessarilyhave a BaseCharacteristic ofinherit from eithertrue_type
orfalse_type
. —_end note_]- In 21.3.9 [meta.logical] p6, edit as follows:
template<class... B> struct disjunction : see below { };-6- The
BaseCharacteristic of aspecializationdisjunction<B1, ..., BN>
has a public and unambiguous base that is either
- the first type
Bi
in the listtrue_type, B1, ..., BN
for whichbool(Bi::value)
istrue
, or,- if there is no such
Bi
, the last type in the list.is the first typeBi
in the listtrue_type, B1, ..., BN
for whichBi::value != false
, or if everyBi::value == false
, the BaseCharacteristic is the last type in the list.-?- The member names of the base class, other than
disjunction
andoperator=
, shall not be hidden and shall be unambiguously available indisjunction
. [Note: This means a specialization ofdisjunction
does not necessarilyhave a BaseCharacteristic ofinherit from eithertrue_type
orfalse_type
. —_end note_]- In 21.3.9 [meta.logical] p8, edit as follows
template struct negation : bool_constant<!bool(B::value)> { };-8- The class template negation forms the logical negation of its template type argument. The type
negation<B>
is a UnaryTypeTrait with a BaseCharacteristic ofbool_constant<!bool(B::value)>
.
[2016-08-03 Chicago]
Fri AM: Moved to Tentatively Ready
Proposed resolution:
This wording is relative to N4606.
- In 21.3.9 [meta.logical] p3, edit as follows:
template<class... B> struct conjunction : see below { };[…]
-3- The
BaseCharacteristic of aspecializationconjunction<B1, ..., BN>
has a public and unambiguous base that is either- — the first type
Bi
in the listtrue_type, B1, ..., BN
for whichbool(Bi::value)
isfalse
, or - — if there is no such
Bi
, the last type in the list.is the first type[Note: This means a specialization ofBi
in the listtrue_type, B1, ..., BN
for whichBi::value == false
, or if everyBi::value != false
, the BaseCharacteristic is the last type in the list.conjunction
does not necessarilyhave a BaseCharacteristic ofinherit from eithertrue_type
orfalse_type
. —_end note_]
-?- The member names of the base class, other than
conjunction
andoperator=
, shall not be hidden and shall be unambiguously available inconjunction
. - — the first type
- In 21.3.9 [meta.logical] p6, edit as follows:
template<class... B> struct disjunction : see below { };[…]
-6- The
BaseCharacteristic of aspecializationdisjunction<B1, ..., BN>
has a public and unambiguous base that is either- — the first type
Bi
in the listfalse_type, B1, ..., BN
for whichbool(Bi::value)
istrue
, or, - — if there is no such
Bi
, the last type in the list.is the first type[Note: This means a specialization ofBi
in the listfalse_type, B1, ..., BN
for whichBi::value != false
, or if everyBi::value == false
, the BaseCharacteristic is the last type in the list.disjunction
does not necessarilyhave a BaseCharacteristic ofinherit from eithertrue_type
orfalse_type
. —_end note_]
-?- The member names of the base class, other than
disjunction
andoperator=
, shall not be hidden and shall be unambiguously available indisjunction
. - — the first type
- In 21.3.9 [meta.logical] p8, edit as follows
template struct negation : see below{ };bool_constant<!B::value>
-8- The class template negation forms the logical negation of its template type argument. The type
negation<B>
is a UnaryTypeTrait with a BaseCharacteristic ofbool_constant<!bool(B::value)>
.