339. definition of bitmask type restricted to clause 27

Section: 25.4.1 [category.ctype], 20.4.2.1.4 [bitmask.types] Status: CD1 Submitter: Martin Sebor Opened: 2001-09-17 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [category.ctype].

View all issues with CD1 status.

Discussion:

The ctype_category::mask type is declared to be an enum in 25.4.1 [category.ctype] with p1 then stating that it is a bitmask type, most likely referring to the definition of bitmask type in 20.4.2.1.4 [bitmask.types], p1. However, the said definition only applies to clause 27, making the reference in 22.2.1 somewhat dubious.

Proposed resolution:

Clarify 17.3.2.1.2, p1 by changing the current text from

Several types defined in clause 27 are bitmask types. Each bitmask type can be implemented as an enumerated type that overloads certain operators, as an integer type, or as a bitset (23.9.2 [template.bitset]).

to read

Several types defined in clauses lib.language.support through lib.input.output and Annex D are bitmask types. Each bitmask type can be implemented as an enumerated type that overloads certain operators, as an integer type, or as a bitset (lib.template.bitset).

Additionally, change the definition in 22.2.1 to adopt the same convention as in clause 27 by replacing the existing text with the following (note, in particluar, the cross-reference to 17.3.2.1.2 in 22.2.1, p1):

22.2.1 The ctype category [lib.category.ctype]

namespace std {
    class ctype_base {
    public:
        typedef T mask;

        // numeric values are for exposition only.
        static const mask space = 1 << 0;
        static const mask print = 1 << 1;
        static const mask cntrl = 1 << 2;
        static const mask upper = 1 << 3;
        static const mask lower = 1 << 4;
        static const mask alpha = 1 << 5;
        static const mask digit = 1 << 6;
        static const mask punct = 1 << 7;
        static const mask xdigit = 1 << 8;
        static const mask alnum = alpha | digit;
        static const mask graph = alnum | punct;
    };
}

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

[Curaçao: The LWG notes that T above should be bold-italics to be consistent with the rest of the standard.]