Title
Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraits
Status
c++17
Section
[meta.logical]
Submitter
Tim Song

Created on 2015-12-10.00:00:00 last changed 90 months ago

Messages

Date: 2016-08-06.20:44:18

Proposed resolution:

This wording is relative to N4606.

  1. In [meta.logical] p3, edit as follows:

    template<class... B> struct conjunction : see below { };
    

    […]

    -3- The BaseCharacteristic of a specialization conjunction<B1, ..., BN> has a public and unambiguous base that is either

    1. the first type Bi in the list true_type, B1, ..., BN for which bool(Bi::value) is false, or
    2. if there is no such Bi, the last type in the list.
    is the first type Bi in the list true_type, B1, ..., BN for which Bi::value == false, or if every Bi::value != false, the BaseCharacteristic is the last type in the list.[Note: This means a specialization of conjunction does not necessarily have a BaseCharacteristic of inherit from either true_type or false_type. —end note]

    -?- The member names of the base class, other than conjunction and operator=, shall not be hidden and shall be unambiguously available in conjunction.

  2. In [meta.logical] p6, edit as follows:

    template<class... B> struct disjunction : see below { };
    

    […]

    -6- The BaseCharacteristic of a specialization disjunction<B1, ..., BN> has a public and unambiguous base that is either

    1. the first type Bi in the list false_type, B1, ..., BN for which bool(Bi::value) is true, or,
    2. if there is no such Bi, the last type in the list.
    is the first type Bi in the list false_type, B1, ..., BN for which Bi::value != false, or if every Bi::value == false, the BaseCharacteristic is the last type in the list.[Note: This means a specialization of disjunction does not necessarily have a BaseCharacteristic of inherit from either true_type or false_type. —end note]

    -?- The member names of the base class, other than disjunction and operator=, shall not be hidden and shall be unambiguously available in disjunction.

  3. In [meta.logical] p8, edit as follows

    template<class B> struct negation : see belowbool_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 of bool_constant<!bool(B::value)>.

Date: 2016-08-03.00:00:00

[ 2016-08-03 Chicago ]

Fri AM: Moved to Tentatively Ready

Date: 2016-08-04.22:44:16

[ 2016-08 Chicago ]

Ville provided wording for both 2567 and 2568

Previous resolution [SUPERSEDED]:

In [meta.logical]/3, edit as follows:

The BaseCharacteristic of a specialization conjunction<B1, ..., BN> has a public and unambiguous base that is the first type Bi in the list true_type, B1, ..., BN for which Bi::value == false, or if every Bi::value != false, the aforementioned baseBaseCharacteristic is the last type in the list. [ Note: This means a specialization of conjunction does not necessarily have a BaseCharacteristic of derive from either true_type or false_type. — end note ]

In [meta.logical]/6, edit as follows:

The BaseCharacteristic of a specialization disjunction<B1, ..., BN> has a public and unambiguous base that is the first type Bi in the list false_type, B1, ..., BN for which Bi::value != false, or if every Bi::value == false, the aforementioned baseBaseCharacteristic is the last type in the list. [ Note: This means a specialization of disjunction does not necessarily have a BaseCharacteristic of derive from either true_type or false_type. — end note ]

Previous resolution [SUPERSEDED]:

In [meta.logical]/3, edit as follows:

The BaseCharacteristic of a specialization conjunction<B1, ..., BN> has a public and unambiguous base that is either
* the first type Bi in the list true_type, B1, ..., BN for which Bi::value == false, or
* if there is no such Bi, the last type in the list.

is the first type Bi in the list true_type, B1, ..., BN for which Bi::value == false, or if every Bi::value != false, the BaseCharacteristic is the last type in the list.
[ Note: This means a specialization of conjunction does not necessarily have a BaseCharacteristic of derive from either true_type or false_type. — end note ]

In [meta.logical]/6, edit as follows:

The BaseCharacteristic of a specialization disjunction<B1, ..., BN> has a public and unambiguous base that is either
* the first type Bi in the list true_type, B1, ..., BN for which Bi::value != false, or
* if there is no such Bi, the last type in the list.

is the first type Bi in the list true_type, B1, ..., BN for which Bi::value != false, or if every Bi::value == false, the BaseCharacteristic is the last type in the list.
[ Note: This means a specialization of disjunction does not necessarily have a BaseCharacteristic of derive from either true_type or false_type. — end note ]

Merged the resolution of 2587 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.

  1. In [meta.logical] p3, edit as follows:

    template<class... B> struct conjunction : see below { };
    

    -3- The BaseCharacteristic of a specialization conjunction<B1, ..., BN> has a public and unambiguous base that is either

    • the first type Bi in the list true_type, B1, ..., BN for which bool(Bi::value) is false, or
    • if there is no such Bi, the last type in the list.
    is the first type Bi in the list true_type, B1, ..., BN for which Bi::value == false, or if every Bi::value != false, the BaseCharacteristic is the last type in the list.

    -?- The member names of the base class, other than conjunction and operator=, shall not be hidden and shall be unambiguously available in conjunction. [Note: This means a specialization of conjunction does not necessarily have a BaseCharacteristic of inherit from either true_type or false_type. —end note]

  2. In [meta.logical] p6, edit as follows:

    template<class... B> struct disjunction : see below { };
    

    -6- The BaseCharacteristic of a specialization disjunction<B1, ..., BN> has a public and unambiguous base that is either

    • the first type Bi in the list true_type, B1, ..., BN for which bool(Bi::value) is true, or,
    • if there is no such Bi, the last type in the list.
    is the first type Bi in the list true_type, B1, ..., BN for which Bi::value != false, or if every Bi::value == false, the BaseCharacteristic is the last type in the list.

    -?- The member names of the base class, other than disjunction and operator=, shall not be hidden and shall be unambiguously available in disjunction. [Note: This means a specialization of disjunction does not necessarily have a BaseCharacteristic of inherit from either true_type or false_type. —end note]

  3. In [meta.logical] p8, edit as follows

    template<class B> 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 of bool_constant<!bool(B::value)>.

Date: 2015-12-10.00:00:00

The specification of conjunction and disjunction uses the term BaseCharacteristic, which is problematic in several ways:

  • That term is defined in [meta.rqmts], but only for UnaryTypeTraits and BinaryTypeTraits. conjunction and disjunction seem to be neither.

  • [meta.rqmts] also requires the BaseCharacteristic for both UnaryTypeTraits and BinaryTypeTraits to be a specialization of integral_constant, which is inconsistent with the current design of conjunction and disjunction.

  • The requirement in [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 of conjunction or disjunction derives may contain members called conjunction or disjunction that will necessarily be hidden.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-06 20:44:18adminsetmessages: + msg8438
2016-08-06 20:44:18adminsetstatus: new -> ready
2016-08-02 12:53:51adminsetmessages: + msg8299
2016-08-02 12:53:51adminsetmessages: + msg8298
2015-12-10 00:00:00admincreate