[type.descriptions] (original) (raw)
16 Library introduction [library]
16.3 Method of description [description]
16.3.3 Other conventions [conventions]
16.3.3.3 Type descriptions [type.descriptions]
16.3.3.3.1 General [type.descriptions.general]
The Requirements subclauses may describe names that are used to specify constraints on template arguments.161
These names are used in library Clauses to describe the types that may be supplied as arguments by a C++ program when instantiating template components from the library.
Certain types defined in [input.output] are used to describe implementation-defined types.
They are based on other types, but with added constraints.
16.3.3.3.2 Exposition-only types [expos.only.types]
Several types defined in [support] through [thread]and [depr] are defined for the purpose of exposition.
The declaration of such a type is followed by a comment ending in exposition only.
[Example 1: namespace std { extern "C" using some-handler = int(int, void*, double); }
The type placeholder some-handler can now be used to specify a function that takes a callback parameter with C language linkage.
— _end example_]
16.3.3.3.3 Enumerated types [enumerated.types]
Each enumerated type may be implemented as an enumeration or as a synonym for an enumeration.162
The enumerated type enumerated can be written:enum enumerated { , , , , … };inline const ();inline const ();inline const ();inline const (); ⋮
Here, the names ,, etc. representenumerated elementsfor this particular enumerated type.
All such elements have distinct values.
16.3.3.3.4 Bitmask types [bitmask.types]
Each bitmask type can be implemented as an enumerated type that overloads certain operators, as an integer type, or as abitset.
The bitmask type bitmask can be written: enum bitmask : int_type { = 1 << 0, = 1 << 1, = 1 << 2, = 1 << 3, … };inline constexpr ();inline constexpr ();inline constexpr ();inline constexpr (); ⋮constexpr _bitmask_ operator&(_bitmask_ X, _bitmask_ Y) { return static_cast<_bitmask_>( static_cast<int_type>(X) & static_cast<int_type>(Y));} constexpr bitmask operator|(bitmask X, bitmask Y) { return static_cast<_bitmask_>( static_cast<int_type>(X) | static_cast<int_type>(Y));} constexpr bitmask operator^(bitmask X, bitmask Y){ return static_cast<_bitmask_>( static_cast<int_type>(X) ^ static_cast<int_type>(Y));} constexpr bitmask operator~(bitmask X){ return static_cast<_bitmask_>(~static_cast<int_type>(X));} bitmask& operator&=(bitmask& X, bitmask Y){ X = X & Y; return X;} bitmask& operator|=(bitmask& X, bitmask Y) { X = X | Y; return X;} bitmask& operator^=(bitmask& X, bitmask Y) { X = X ^ Y; return X;}
Here, the names ,, etc. representbitmask elementsfor this particular bitmask type.
All such elements have distinct, nonzero values such that, for any pair and where , & is nonzero and & is zero.
Additionally, the value 0 is used to represent an empty bitmask, in which no bitmask elements are set.
The following terms apply to objects and values of bitmask types:
- To seta value Y in an object _X_is to evaluate the expression X |= Y.
- To cleara value Y in an object_X_ is to evaluate the expression X &= ~Y.
- The value Y is set in the object_X_ if the expression X & Y is nonzero.
16.3.3.3.5 Character sequences [character.seq]
16.3.3.3.5.1 General [character.seq.general]
The C standard library makes widespread useof characters and character sequences that follow a few uniform conventions:
- A letter is any of the 26 lowercase or 26uppercase letters in the basic execution character set.
- Thedecimal-point characteris the (single-byte) character used by functions that convert between a (single-byte) character sequence and a value of one of the floating-point types.
It is used in the character sequence to denote the beginning of a fractional part.
It is represented in [support] through [thread]and [depr] by a period,'.', which is also its value in the "C"locale, but may change during program execution by a call tosetlocale(int, const char*),163or by a change to alocaleobject, as described in [locales] and [input.output]. - Acharacter sequenceis an array object A that can be declared as_T A_[N_], where T is any of the typeschar,unsigned char, orsigned char ([basic.fundamental]), optionally qualified by any combination ofconstorvolatile.
The initial elements of the array have defined contents up to and including an element determined by some predicate.
A character sequence can be designated by a pointer value_S that points to its first element.
16.3.3.3.5.2 Byte strings [byte.strings]
A null-terminated byte string, or ntbs, is a character sequence whose highest-addressed element with defined content has the value zero (the terminating null character); no other element in the sequence has the value zero.164
The length of an ntbsis the number of elements that precede the terminating null character.
An empty ntbshas a length of zero.
The value of an ntbsis the sequence of values of the elements up to and including the terminating null character.
A static ntbsis an ntbs with static storage duration.[165](#footnote-165 "A string-literal, such as "abc", is a static ntbs.")
16.3.3.3.5.3 Multibyte strings [multibyte.strings]
A null-terminated multibyte string, or ntmbs, is an ntbs that constitutes a sequence of valid multibyte characters, beginning and ending in the initial shift state.166
A static ntmbsis an ntmbs with static storage duration.
16.3.3.3.6 Customization Point Object types [customization.point.object]
A customization point object is a function object ([function.objects]) with a literal class type that interacts with program-defined types while enforcing semantic requirements on that interaction.
All instances of a specific customization point object type shall be equal ([concepts.equality]).
The type T of a customization point object shall modelinvocable<const T&, Args...> ([concept.invocable]) when the types in Args... meet the requirements specified in that customization point object's definition.
When the types of Args... do not meet the customization point object's requirements, T shall not have a function call operator that participates in overload resolution.
Each customization point object type constrains its return type to model a particular concept.
[Note 1:
Many of the customization point objects in the library evaluate function call expressions with an unqualified name which results in a call to a program-defined function found by argument dependent name lookup ([basic.lookup.argdep]).
To preclude such an expression resulting in a call to unconstrained functions with the same name in namespace std, customization point objects specify that lookup for these expressions is performed in a context that includes deleted overloads matching the signatures of overloads defined in namespace std.
When the deleted overloads are viable, program-defined overloads need be more specialized ([temp.func.order]) or more constrained ([temp.constr.order]) to be used by a customization point object.
— _end note_]