Title
Static data members of ctype_base are not yet required to be usable in constant expressions
Status
wp
Section
[category.ctype.general]
Submitter
Jiang An

Created on 2024-01-12.00:00:00 last changed 7 months ago

Messages

Date: 2024-04-02.10:29:12

Proposed resolution:

This wording is relative to N4971.

  1. Modify [category.ctype.general] as indicated:

    namespace std {
      class ctype_base {
      public:
        using mask = see below;
    
        // numeric values are for exposition only.
        static constexpr mask space  = 1 << 0;
        static constexpr mask print  = 1 << 1;
        static constexpr mask cntrl  = 1 << 2;
        static constexpr mask upper  = 1 << 3;
        static constexpr mask lower  = 1 << 4;
        static constexpr mask alpha  = 1 << 5;
        static constexpr mask digit  = 1 << 6;
        static constexpr mask punct  = 1 << 7;
        static constexpr mask xdigit = 1 << 8;
        static constexpr mask blank  = 1 << 9;
        static constexpr mask alnum  = alpha | digit;
        static constexpr mask graph  = alnum | punct;
      };
    }
    

    -1- The type mask is a bitmask type ([bitmask.types]).

Date: 2024-04-02.10:29:12

[ Tokyo 2024-03-23; Status changed: Voting → WP. ]

Date: 2024-03-15.00:00:00

[ 2024-03-12; Reflector poll ]

Set status to Tentatively Ready after five votes in favour during reflector poll.

Date: 2024-01-12.00:00:00

It may be desired that static data members ctype_base are "real constants", i.e. usable in constant expressions. However, this is not strictly required because mask is only required to be a bitmask type that can be a class type, which makes the plain const potentially insufficient.

History
Date User Action Args
2024-04-02 10:29:12adminsetmessages: + msg14045
2024-04-02 10:29:12adminsetstatus: voting -> wp
2024-03-18 09:32:04adminsetstatus: ready -> voting
2024-03-13 17:41:34adminsetmessages: + msg14008
2024-03-13 17:41:34adminsetstatus: new -> ready
2024-01-14 07:55:40adminsetmessages: + msg13918
2024-01-12 00:00:00admincreate