[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.137

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 Enumerated types [enumerated.types]

Each enumerated type may be implemented as an enumeration or as a synonym for an enumeration.138

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.3 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 i ≠ j, & 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:

16.3.3.3.4 Character sequences [character.seq]

16.3.3.3.4.1 General [character.seq.general]

The C standard library makes widespread useof characters and character sequences that follow a few uniform conventions:

16.3.3.3.4.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.139

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.[140](#footnote-140 "A string-literal, such as "abc", is a static ntbs.")

16.3.3.3.4.3 Multibyte strings [multibyte.strings]

A multibyte character is a sequence of one or more bytes representing the code unit sequence for an encoded character of the execution character set.

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.141

A static ntmbsis an ntmbs with static storage duration.

16.3.3.3.5 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 effects of invoking different instances of a specific customization point object type on the same arguments are equivalent.

The type T of a customization point object, ignoring cv-qualifiers, shall modelinvocable<T&, Args...>,invocable<const T&, Args...>,invocable<T, Args...>, andinvocable<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.

For a given customization point object o, let p be a variable initialized as if by auto p = o;.

Then for any sequence of arguments args..., the following expressions have effects equivalent to o(args...):