9.1 Functions that create nonclass types

There are three functions that create types that are not classes: singleton, type-union, and limited.

singleton

Takes any instance, and creates a type whose only member is that instance. You can define a singleton type to be used as the parameter specializer of a method that should be chosen for a particular instance.

type-union

Takes one or more classes or types, and creates a new type whose members include all the members of the types that are its arguments.

limited

Takes a type and creates a new type, which is a more restricted version of the type that is its argument (the base type). For example, you can define a new type that is based on <integer>, but has a given minimum or maximum value. Another example is to define a new collection type that specifies the type of elements, such as a type that is a vector of integers. The main reasons for defining types with limited are to perform type checking and to increase efficiency. For information about the performance of limited types, Section 19.4, page 315.

Convention: Type names, like class names, are surrounded with angle brackets — for example, <nonnegative-integer>.