1092. Class template integral_constant should be a constrained template

Section: 23.15.3 [meta.help] Status: NAD Concepts Submitter: Daniel Krügler Opened: 2009-03-22 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [meta.help].

View all issues with NAD Concepts status.


A first step to change the type traits predicates to constrained templates is to constrain their common base template integral_constant. This can be done, without enforcing depending classes to be constrained as well, but not vice versa without brute force late_check usages. The following proposed resolution depends on the resolution of LWG issue 1019.

[ Batavia (2009-05): ]

Move to Open, pending a paper that looks at constraints for the entirety of the type traits and their relationship to the foundation concepts. We recommend this be deferred until after the next Committee Draft is issued.

Proposed resolution:

  1. In 23.15.2 [meta.type.synop], Header <type_traits> synopsis change as indicated:

    namespace std {
    // 20.5.3, helper class:
    template <classIntegralConstantExpressionType T, T v> struct integral_constant;
  2. In 23.15.3 [meta.help] change as indicated:

    template <classIntegralConstantExpressionType T, T v>
    struct integral_constant {
      static constexpr T value = v;
      typedef T value_type;
      typedef integral_constant<T,v> type;
      constexpr operator value_type() { return value; }