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.

2514. Type traits must not be final

Section: 21.3.2 [meta.rqmts] Status: C++17 Submitter: Jonathan Wakely Opened: 2015-07-03 Last modified: 2017-07-30

Priority: 3

View all other issues in [meta.rqmts].

View all issues with C++17 status.

Discussion:

We should make it clear that all standard UnaryTypeTraits, BinaryTypeTraits and TransformationTraits are not final.

Otherwise it is not safe to use them as arguments to a template like this:

template<typename C1, typename C2>
struct conjunction
  : conditional_t<C1::value, C2, C1>
{ };

[2016-08-03 Chicago LWG]

Walter, Nevin, and Jason provide initial Proposed Resolution.

Previous resolution [SUPERSEDED]:

This wording is relative to N4606.

  1. Change 21.3.2 [meta.rqmts] as indicated:

    -1- A UnaryTypeTrait describes a property of a type. It shall be a non-final class template […]

    -2- A BinaryTypeTrait describes a relationship between two types. It shall be a non-final class template […]

    -3- A TransformationTrait modifies a property of a type. It shall be a non-final class template […]

[2016-08-04 Chicago LWG]

LWG discusses and expresses preference for a more general, Library-wide, resolution. Walter and Nevin provide a new Proposed Resolution consistent with such guidance.

[2016-08 - Chicago]

Thurs PM: Moved to Tentatively Ready

Proposed resolution:

This wording is relative to N4606.

  1. Add a new paragraph add the end of 16.4.6.12 [derivation] as indicated:

    -?- All types specified in the C++ standard library shall be non-final types unless otherwise specified.