templates
cpp.Bindings
Section titled “cpp.Bindings”def Bindings : TypeWhat the parameters are bound to (a parameter’s name, its argument).
cpp.ClassTemplates
Section titled “cpp.ClassTemplates”def ClassTemplates : TypeThe class templates of a program: each one’s name, parameters and definition.
cpp.Templates.classes
Section titled “cpp.Templates.classes”def Templates.classes (items : List Item) : ClassTemplatesThe class templates of the items: name, parameters and definition.
cpp.Templates.parameterName
Section titled “cpp.Templates.parameterName”def Templates.parameterName (p : TemplateParam) : StringA template parameter’s name.
cpp.Templates.parameterDefault
Section titled “cpp.Templates.parameterDefault”def Templates.parameterDefault (p : TemplateParam) : Option TypeSyntaxA template parameter’s default argument, if it has one.
cpp.TemplateDefinition
Section titled “cpp.TemplateDefinition”def TemplateDefinition : TypeA function template: its parameters and its definition.
cpp.FunctionTemplate
Section titled “cpp.FunctionTemplate”def FunctionTemplate : TypeA function template by its name.
cpp.Templates.functions
Section titled “cpp.Templates.functions”def Templates.functions (items : List Item) : List (String * (List TemplateParam * FunctionDefinition))The function templates of the items: name, parameters and definition.
cpp.Templates.valueOf
Section titled “cpp.Templates.valueOf”def Templates.valueOf (b : List (String * TypeSyntax)) (x : String) : Option IntThe value a parameter is bound to, as an integer, when it is one (a non-type parameter’s argument).
cpp.Templates.collapsed
Section titled “cpp.Templates.collapsed”def Templates.collapsed (t : TypeSyntax) : TypeSyntaxA reference to a reference collapsed ([dcl.ref]p6): an lvalue reference if either is one, else an rvalue reference; any other type as it is.
cpp.Templates.substitution
Section titled “cpp.Templates.substitution”def Templates.substitution (b : List (String * TypeSyntax)) : SyntaxMapPutting the template’s arguments in place of its parameters: a type parameter by its type (a reference to a reference so made collapsed), a non-type parameter’s uses and the array lengths written with it by its value.
cpp.Templates.namingDepth
Section titled “cpp.Templates.namingDepth”def Templates.namingDepth : NatHow many instances deep the defaults of a class template’s arguments are compared when its name is written (the types programs write are far shallower).
cpp.Templates.spelled
Section titled “cpp.Templates.spelled”def Templates.spelled (ct : ClassTemplates) (t : TypeSyntax) : StringA template argument t as clang writes it (the class templates ct give the defaults to leave out).
cpp.Templates.spelledAll
Section titled “cpp.Templates.spelledAll”def Templates.spelledAll (ct : ClassTemplates) (ts : List TypeSyntax) : StringTemplate arguments ts as clang writes them, separated by commas (the class templates ct give the defaults to
leave out).
cpp.Templates.instanceName
Section titled “cpp.Templates.instanceName”def Templates.instanceName (ct : ClassTemplates) (x : String) (args : List TypeSyntax) : StringAn instance’s name: the template x’s with its arguments args (mx<int>, Box<int, 3>), a class template’s
without the arguments at the end that are the defaults (std::set<int>, not std::set<int, std::less<int>>), as clang
writes it; ct gives the class templates. The name is the instance’s identity: the same arguments, written or
defaulted, name the same class.
cpp.Templates.bindings
Section titled “cpp.Templates.bindings”def Templates.bindings(ps : List TemplateParam) (args : List TypeSyntax) : List (String * TypeSyntax)The parameters bound to the arguments, in order.
cpp.Templates.packOf
Section titled “cpp.Templates.packOf”def Templates.packOf (ps : List TemplateParam) : Option StringThe type parameter pack a template ends with, if it has one.
cpp.Templates.element
Section titled “cpp.Templates.element”def Templates.element (x : DeclId) (i : Nat) : DeclIdA function parameter pack’s element (args#i), a declaration of the instance.
cpp.Templates.numberedFrom
Section titled “cpp.Templates.numberedFrom”def Templates.numberedFrom (i : Nat) (ts : List TypeSyntax) : List (Nat * TypeSyntax)The element types of a pack with their positions.
cpp.Templates.elementOf
Section titled “cpp.Templates.elementOf”def Templates.elementOf (x : DeclId) (pk : String) (e : Nat * TypeSyntax) : SyntaxMapA pack expansion’s pattern for one element: the function parameter pack’s uses its element, the type parameter pack its type.
cpp.Templates.expansion
Section titled “cpp.Templates.expansion”def Templates.expansion (x : DeclId) (pk : String) (elements : List TypeSyntax) : SyntaxMapExpanding a function parameter pack x (of the type pack pk) for its element types: each pattern expansion in a
call’s arguments one argument per element ([temp.variadic]p8), sizeof...(x) the number of elements.
cpp.Templates.expandedParameters
Section titled “cpp.Templates.expandedParameters”def Templates.expandedParameters (pk : String) (elements : List TypeSyntax) (params : List Param) : List ParamThe parameters with a function parameter pack (P... args) as one parameter per element, args#i.
cpp.Templates.packParameter
Section titled “cpp.Templates.packParameter”def Templates.packParameter (params : List Param) : Option DeclIdThe function parameter pack of the parameters, if there is one.
cpp.Templates.instanceOf
Section titled “cpp.Templates.instanceOf”def Templates.instanceOf (ct : ClassTemplates) (ps : List TemplateParam) (f : FunctionDefinition) (args : List TypeSyntax) : ItemThe instance for the arguments args of a function template (parameters ps, definition f): an ordinary
function named for them (the class templates ct give the defaults its name leaves out). A variadic one’s last
arguments are its pack’s elements: its function parameter pack and the expansions of it are expanded for them.
cpp.Templates.instanceNamed
Section titled “cpp.Templates.instanceNamed”def Templates.instanceNamed (ct : ClassTemplates) (base : String) (ps : List TemplateParam) (f : FunctionDefinition) (args : List TypeSyntax) : ItemThe instance for the arguments args of the template with parameters ps and definition f, named for base (the
template’s name, or f#tk for one of overloads with as many template parameters, Templates.overloadBase; the class
templates ct give the defaults the name leaves out).
cpp.Templates.integerSyntax
Section titled “cpp.Templates.integerSyntax”def Templates.integerSyntax (t : IntegerType) : TypeSyntaxAn integer type as written.
cpp.Templates.named
Section titled “cpp.Templates.named”def Templates.named (name : String) : TypeSyntaxA class’s type by its name.
cpp.Templates.unqualified
Section titled “cpp.Templates.unqualified”def Templates.unqualified (t : TypeSyntax) : TypeSyntaxA type without its top-level const.
cpp.Templates.argumentName
Section titled “cpp.Templates.argumentName”def Templates.argumentName (y : String) (k : Nat) : StringThe k-th template argument of a class instance, from the hidden typedef the instance comes with.
cpp.Templates.argumentsOf
Section titled “cpp.Templates.argumentsOf”def Templates.argumentsOf (g : Globals Cpp.constructs) (y : String) (count : Nat) : Option (List TypeSyntax)A class instance’s template arguments (count of them), from its hidden typedefs.
cpp.Templates.lvalueTypeOf
Section titled “cpp.Templates.lvalueTypeOf”def Templates.lvalueTypeOf (p : Platform) (a : TypedExpr Cpp.constructs) : Ty Cpp.constructsAn argument’s type as an lvalue, without its top-level const.
cpp.Templates.valueTypeOf
Section titled “cpp.Templates.valueTypeOf”def Templates.valueTypeOf (p : Platform) (a : TypedExpr Cpp.constructs) : Ty Cpp.constructsAn argument’s type as a value (an array or function decayed), without its top-level const.
cpp.Templates.fromArgument
Section titled “cpp.Templates.fromArgument”def Templates.fromArgument (g : Globals Cpp.constructs) (fixed : List String) (b : Option Bindings) (p : Param) (a : TypedExpr Cpp.constructs) : Option (List (String * TypeSyntax))Deduces from one argument a for the parameter p (in the globals g), adding to what is bound b (the parameters
in fixed were written, not deduced): a reference parameter against the lvalue’s type, another against the value’s; a
forwarding reference (T && of a parameter T) takes an lvalue as U & and an rvalue as U ([temp.deduct.call]p3); an
rvalue does not bind to a reference to a type that is not const.
cpp.Templates.bare
Section titled “cpp.Templates.bare”def Templates.bare (t : TypeSyntax) : TypeSyntaxA written type without its references and top-level const (std::remove_cvref_t).
cpp.Templates.decayed
Section titled “cpp.Templates.decayed”def Templates.decayed (t : TypeSyntax) : TypeSyntaxA written type decayed (std::decay_t, [meta.trans.other]): references and top-level const taken away, an array the pointer to its element.
cpp.Templates.arithmetic
Section titled “cpp.Templates.arithmetic”def Templates.arithmetic (t : TypeSyntax) : BoolWhether the written type t is an arithmetic type, cv-qualified or not (std::is_arithmetic_v,
[basic.fundamental]p14: the integral and the floating-point types).
cpp.Templates.enumeration
Section titled “cpp.Templates.enumeration”def Templates.enumeration (t : TypeSyntax) : BoolWhether the written type t is an enumeration, cv-qualified or not (std::is_enum_v, [dcl.enum]).
cpp.Templates.truth
Section titled “cpp.Templates.truth”def Templates.truth (t : TypeSyntax) : Option BoolA constant template argument as a truth value (an integer, nonzero is true), if it is one.
cpp.Templates.fromTruth
Section titled “cpp.Templates.fromTruth”def Templates.fromTruth (b : Bool) : TypeSyntaxA truth value as a constant template argument.
cpp.Templates.traitsDone
Section titled “cpp.Templates.traitsDone”def Templates.traitsDone (fuel : Nat) (t : TypeSyntax) : Option TypeSyntaxA substituted default template argument with the standard type traits it uses worked out ([meta]): decay_t,
remove_reference_t, remove_cv_t, remove_const_t, is_same_v, is_arithmetic_v, is_enum_v, !; enable_if_t<c, T> is T (void without it)
when c is true and fails when it is false (substitution failure, [temp.deduct]p8: none). Anything else as it is.
cpp.Templates.traitsDoneAll
Section titled “cpp.Templates.traitsDoneAll”def Templates.traitsDoneAll (fuel : Nat) (ts : List TypeSyntax) : Option (List TypeSyntax)Each argument with its traits worked out, unless one fails.
cpp.Templates.trait
Section titled “cpp.Templates.trait”def Templates.trait (x : String) (args : List TypeSyntax) : Option TypeSyntaxA standard trait applied to worked-out arguments (Templates.traitsDone); a template that is not one as it is.
cpp.Templates.completed
Section titled “cpp.Templates.completed”def Templates.completed (ps : List TemplateParam) (b : List (String * TypeSyntax)) : Option (List TypeSyntax)Every parameter’s argument, in order: the bound one, else its default (which may use the ones before it), with the standard traits it uses worked out; a default whose substitution fails (std::enable_if_t of false) fails the deduction, so the template is not a candidate ([temp.deduct]p8).
cpp.Templates.scalarSpellings
Section titled “cpp.Templates.scalarSpellings”def Templates.scalarSpellings : List (String * TypeSyntax)The scalar types a template argument is spelled as (Templates.spelled), each with its spelling.
cpp.Templates.unspelled
Section titled “cpp.Templates.unspelled”def Templates.unspelled (fuel : Nat) (text : String) : Option TypeSyntaxA template argument back from its spelling, when it is a scalar type or one with const, * or & on it (a class’s
spelling does not say whether it is a class, a struct or a typedef: none).
cpp.Templates.splitArguments
Section titled “cpp.Templates.splitArguments”def Templates.splitArguments (depth : Nat) (current : List Char) (cs : List Char) : List StringText split at its top-level commas (not inside angle brackets), each part as written after the comma.
cpp.Templates.argumentText
Section titled “cpp.Templates.argumentText”def Templates.argumentText (text : String) : StringA template argument’s text without the space Templates.spelledAll writes after a comma.
cpp.Templates.overloads
Section titled “cpp.Templates.overloads”def Templates.overloads (templates : List FunctionTemplate) (f : String) : List TemplateDefinitionThe function templates of a name (overloads of one name, [temp.over]).
cpp.Templates.overloadFor
Section titled “cpp.Templates.overloadFor”def Templates.overloadFor (overloads : List (List TemplateParam * FunctionDefinition)) (count : Nat) : Option (List TemplateParam * FunctionDefinition)Among the function templates of a name, the one an instance with a number of template arguments is of: the only one,
or the one with as many parameters (or with a pack, which takes the rest); overloads that deduce the same number of
arguments are not chosen between (Templates.chosen).
cpp.Templates.overloadBase
Section titled “cpp.Templates.overloadBase”def Templates.overloadBase (f : String) (overloads : List TemplateDefinition) (k : Nat) : StringThe name the k-th of the function templates overloads of the name f gives its instances: f itself, unless another
of them has as many template parameters (then Templates.overloadFor cannot tell them apart, and the name is
f#tk).
cpp.Templates.overloadOf
Section titled “cpp.Templates.overloadOf”def Templates.overloadOf (overloads : List TemplateDefinition) (base : String) (count : Nat) : Option TemplateDefinitionThe template among overloads that an instance base names: f#tk the k-th; f the one for the count of template
arguments (Templates.overloadFor).
cpp.Templates.baseName
Section titled “cpp.Templates.baseName”def Templates.baseName (base : String) : StringThe name an instance base (f or f#tk) is of.
cpp.Templates.comparedTypes
Section titled “cpp.Templates.comparedTypes”def Templates.comparedTypes (t : TemplateDefinition) : List TypeSyntaxA function template’s parameter types, without references and top-level const (as partial ordering compares them, [temp.deduct.partial]p5, p7).
cpp.Templates.moreQualifiedReference
Section titled “cpp.Templates.moreQualifiedReference”def Templates.moreQualifiedReference (a : TypeSyntax) (b : TypeSyntax) : BoolWhether a’s parameter is a reference to a type more cv-qualified than the one b’s parameter references
(const T & against T &, [temp.deduct.partial]p9).
cpp.Templates.writtenTypes
Section titled “cpp.Templates.writtenTypes”def Templates.writtenTypes (t : TemplateDefinition) : List TypeSyntaxA function template’s parameter types as written.
cpp.Templates.atLeastAsSpecialized
Section titled “cpp.Templates.atLeastAsSpecialized”def Templates.atLeastAsSpecialized (g : Globals Cpp.constructs) (a : TemplateDefinition) (b : TemplateDefinition) : BoolWhether the template a is at least as specialized as b (in the globals g, [temp.func.order]p3): b’s parameters
are deduced from a’s parameter types, a’s own template parameters standing for unique types; where both parameters
are lvalue references and b’s references a more cv-qualified type, a is not ([temp.deduct.partial]p9:
f(const T &) is more specialized than f(T &)).
cpp.Templates.instanceTypes
Section titled “cpp.Templates.instanceTypes”def Templates.instanceTypes (v : Nat * TemplateDefinition * List TypeSyntax) : List TypeSyntaxA viable template’s parameter types with its deduced arguments in place.
cpp.Templates.lessQualifiedBinding
Section titled “cpp.Templates.lessQualifiedBinding”def Templates.lessQualifiedBinding (classes : ClassTemplates) (a : TypeSyntax) (b : TypeSyntax) : BoolWhether binding an argument to the parameter type a is a better conversion than to b ([over.ics.rank]p3.2.6):
both references to the same type (compared as written, with the class templates classes), b’s more cv-qualified
(int & against const int &).
cpp.Templates.betterBinding
Section titled “cpp.Templates.betterBinding”def Templates.betterBinding (classes : ClassTemplates) (c : Nat * TemplateDefinition * List TypeSyntax) (d : Nat * TemplateDefinition * List TypeSyntax) : BoolWhether the viable template c’s instance is a better function than d‘s by its arguments’ conversions
([over.match.best]p1): a better reference binding for some argument and a worse one for none (the types compared as
written, with the class templates classes).
cpp.Templates.bestBound
Section titled “cpp.Templates.bestBound”def Templates.bestBound (classes : ClassTemplates) (viable : List (Nat * TemplateDefinition * List TypeSyntax)) : List (Nat * TemplateDefinition * List TypeSyntax)The templates of viable no other one’s instance is better than by its arguments’ conversions (partial ordering
chooses among these, [over.match.best]p2.5; the types compared as written, with the class templates classes).
cpp.Templates.mostSpecialized
Section titled “cpp.Templates.mostSpecialized”def Templates.mostSpecialized (g : Globals Cpp.constructs) (viable : List (Nat * TemplateDefinition * List TypeSyntax)) : Option (Nat * TemplateDefinition * List TypeSyntax)The most specialized of the viable templates (each with its index and deduced arguments, in the globals g): the one at least as specialized as every other and not the other way around ([temp.func.order]); none when no one is.
cpp.Templates.madeInPlace
Section titled “cpp.Templates.madeInPlace”def Templates.madeInPlace (tables : CppTables) (it : Item) : BoolWhether an instance’s definition can be made from the template as the program is checked: its body has no lambda (the program’s passes make a class for each) and every class template’s instance it writes is a class the program has (they are made when the program is prepared).
cpp.Templates.staticCall
Section titled “cpp.Templates.staticCall”def Templates.staticCall (e : Expr) : ExprA static member function’s call through its class (eStaticCall) once the class is known (a template’s instance
written as its class first): the function C::f the class’s lowering declares (cpp.classes); any other as it is.
cpp.Templates.instantiated
Section titled “cpp.Templates.instantiated”def Templates.instantiated (tables : CppTables) (name : String) : Option FunctionDefinitionA function template’s instance by its name (twice<int>): the template’s definition with the arguments in place,
when the name is the template’s with scalar arguments spelled as Templates.instanceName spells them and the body
can be made in place; none otherwise (the call asks for it: the program is prepared and checked again).
cpp.Templates.packElements
Section titled “cpp.Templates.packElements”def Templates.packElements (g : Globals Cpp.constructs) (pk : String) (pattern : Param) (args : List (TypedExpr Cpp.constructs)) : Option (List TypeSyntax)A pack’s element types from the arguments after the other parameters: each one deduced alone against the pattern ([temp.deduct.call]p1).
cpp.Templates.deduceVariadic
Section titled “cpp.Templates.deduceVariadic”def Templates.deduceVariadic (g : Globals Cpp.constructs) (pk : String) (ps : List TemplateParam) (f : FunctionDefinition) (written : List TypeSyntax) (args : List (TypedExpr Cpp.constructs)) : Option (List TypeSyntax)The template arguments a variadic template’s call deduces: the parameters before the pack as any template’s, then the pack’s elements from the remaining arguments.
cpp.Templates.deduce
Section titled “cpp.Templates.deduce”def Templates.deduce (g : Globals Cpp.constructs) (ps : List TemplateParam) (f : FunctionDefinition) (written : List TypeSyntax) (args : List (TypedExpr Cpp.constructs)) : Option (List TypeSyntax)The template arguments a call deduces: the written ones first, then from the arguments.
cpp.Templates.deduceFixed
Section titled “cpp.Templates.deduceFixed”def Templates.deduceFixed (g : Globals Cpp.constructs) (ps : List TemplateParam) (f : FunctionDefinition) (written : List TypeSyntax) (args : List (TypedExpr Cpp.constructs)) : Option (List TypeSyntax)The template arguments a call of a template without a pack deduces.
cpp.Templates.hasOrdinary
Section titled “cpp.Templates.hasOrdinary”def Templates.hasOrdinary (g : Globals Cpp.constructs) (f : String) : BoolWhether ordinary functions have the name too (one, or overloads f#k): a call without template arguments then
chooses among them and the template’s instance (Overloading.withTemplate).
cpp.Templates.chosen
Section titled “cpp.Templates.chosen”def Templates.chosen (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (n : NodeId) (f : String) (written : List TypeSyntax) (args : List Expr) : Option (CheckResult Cpp.constructs String)The function a call of a function template’s name calls: its instance for the deduced arguments, or that
instance asked for; none deduced is what a call matching no function means (Cpp.mismatchOf).
cpp.Templates.takes
Section titled “cpp.Templates.takes”def Templates.takes (f : FunctionDefinition) (count : Nat) : BoolWhether a function takes a number of arguments: no fewer than its parameters without defaults, no more than its parameters; a function parameter pack takes any number, none too ([temp.variadic]p3).
cpp.Templates.leftover
Section titled “cpp.Templates.leftover”def Templates.leftover (e : Expr) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))A pack expansion or sizeof... left after instantiation: an expansion somewhere other than a call’s arguments is
not supported yet; sizeof... of a name that is not a function parameter pack is not C++ ([expr.sizeof]p5). A static
member function’s call through a type that is not a class known here (Templates.staticCall lowers the others) is not
supported yet.
cpp.Templates.expression
Section titled “cpp.Templates.expression”def Templates.expression (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (e : Expr) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))A call of a function template as an expression: its instance’s call.
cpp.Templates.autoAsParameter
Section titled “cpp.Templates.autoAsParameter”def Templates.autoAsParameter : SyntaxMapA declared type with auto in it, auto as the template parameter #auto (deduced as a function template’s
parameter is, [dcl.type.auto.deduct]p4).
cpp.Templates.hasAuto
Section titled “cpp.Templates.hasAuto”def Templates.hasAuto (t : TypeSyntax) : BoolWhether a written type has auto in it.
cpp.Templates.autoDeclaration
Section titled “cpp.Templates.autoDeclaration”def Templates.autoDeclaration (checker : Checker Cpp.constructs) (c : StatementContext Cpp.constructs) (env : Env Cpp.constructs) (s : Stmt) : Option (CheckResult Cpp.constructs Stmt)A declaration whose type has auto in it ([dcl.spec.auto]) made concrete: the type deduced from the initializer as a
function template’s parameter of that type from its argument (auto drops references and top-level const, auto &
binds the lvalue, const auto & reads it). Without an initializer there is nothing to deduce from.
cpp.Templates.boundArray
Section titled “cpp.Templates.boundArray”def Templates.boundArray (g : Globals Cpp.constructs) (n : NodeId) (x : DeclId) (name : String) (t : TypeSyntax) (e : Expr) (a : TypedExpr Cpp.constructs) : Option (CheckResult Cpp.constructs Stmt)The object a structured binding copies when it is an array (auto [a, b] = arr): an array of the same type, each
element copy-initialized from the array’s ([dcl.struct.bind]p1; auto alone would decay it to a pointer); none for any
other declaration. An array that is not a variable is not done (its elements would be evaluated again for each).
cpp.Templates.statement
Section titled “cpp.Templates.statement”def Templates.statement (checker : Checker Cpp.constructs) (statements : StatementChecker Cpp.constructs) (c : StatementContext Cpp.constructs) (env : Env Cpp.constructs) (s : Stmt) : Option (CheckResult Cpp.constructs (TypedStmt Cpp.constructs))A call of a function template as a statement: its instance’s call.
cpp.Templates.answer
Section titled “cpp.Templates.answer”def Templates.answer (seen : List Item) (tag : CppRequest) (types : List (Ty Cpp.constructs)) (written : List TypeSyntax) (items : List Item) : Option (List Item)The answer to C++’s request: the items with the function template’s instance for the arguments added (the template found among the items as checking saw them: a namespace’s with its full name, a generated one).
cpp.Templates.classNode
Section titled “cpp.Templates.classNode”def Templates.classNode (items : List Item) (x : String) : NodeIdA class template’s node, by its name.
cpp.Templates.specializations
Section titled “cpp.Templates.specializations”def Templates.specializations (items : List Item) : List (String * ClassDefinition)The full specializations of class templates (template <> class C<int>): the instance’s name and definition.
cpp.Partial
Section titled “cpp.Partial”record PartialA partial specialization of a class template: the template’s name, its parameters, the arguments it is for (a pattern in its parameters) and its definition.
cpp.Templates.partials
Section titled “cpp.Templates.partials”def Templates.partials (items : List Item) : List PartialThe partial specializations of the items.
cpp.Templates.same
Section titled “cpp.Templates.same”def Templates.same (ct : ClassTemplates) (a : TypeSyntax) (b : TypeSyntax) : BoolWhether the template arguments a and b are the same: written the same (with the class templates ct).
cpp.Partial.atLeastAs
Section titled “cpp.Partial.atLeastAs”def Partial.atLeastAs (ct : ClassTemplates) (a : Partial) (c : Partial) : BoolWhether the partial specialization a is at least as specialized as c ([temp.class.order]): c’s pattern matches
a’s (its parameters taken as types of their own; with the class templates ct).
cpp.Partial.mostSpecialized
Section titled “cpp.Partial.mostSpecialized”def Partial.mostSpecialized (ct : ClassTemplates) (cs : List Partial) : Option PartialThe one of the candidates cs more specialized than every other, if there is one (with the class templates ct).
cpp.Instance
Section titled “cpp.Instance”record InstanceAn instance of a class template: the template’s name, its arguments and its definition (the arguments in place).
cpp.Instance.name
Section titled “cpp.Instance.name”def Instance.name (i : Instance) : StringThe instance i’s name: its class’s (Templates.instanceName).
cpp.Templates.definitionFor
Section titled “cpp.Templates.definitionFor”def Templates.definitionFor (items : List Item) (x : String) (ps : List TemplateParam) (d : ClassDefinition) (args : List TypeSyntax) : CheckResult Cpp.constructs (List (String * TypeSyntax) * ClassDefinition)What a class template’s definition is for these arguments, with its parameters bound: a full specialization, else the one most specialized partial specialization the arguments match, else the template itself; two or more matching with none most specialized is an error ([temp.class.spec.match]p2).
cpp.Templates.classInstance
Section titled “cpp.Templates.classInstance”def Templates.classInstance (items : List Item) (x : String) (args : List TypeSyntax) : CheckResult Cpp.constructs InstanceA class template’s instance: its definition with the arguments in place, the template’s own name in it the instance ([temp.local]p1).
cpp.Templates.filled
Section titled “cpp.Templates.filled”def Templates.filled (ct : ClassTemplates) (t : TypeSyntax) : TypeSyntaxA use’s default template arguments filled in ([temp.param]p10: C<int> of template <class T, int N = 4> is
C<int, 4>; a default may use the parameters before it).
cpp.Templates.fillArguments
Section titled “cpp.Templates.fillArguments”def Templates.fillArguments (ps : List TemplateParam) (args : List TypeSyntax) (b : List (String * TypeSyntax)) : List TypeSyntaxArguments with the parameters’ defaults after them.
cpp.Templates.usesIn
Section titled “cpp.Templates.usesIn”def Templates.usesIn (ct : ClassTemplates) (ts : List TypeSyntax) : List (String * List TypeSyntax)The class template instances some types use (the arguments without parameters).
cpp.Templates.instanceLimit
Section titled “cpp.Templates.instanceLimit”def Templates.instanceLimit : NatThe most instances a program’s class templates may have.
cpp.Templates.closure
Section titled “cpp.Templates.closure”def Templates.closure (items : List Item) (ct : ClassTemplates) (fuel : Nat) (found : List Instance) (todo : List (String * List TypeSyntax)) : CheckResult Cpp.constructs (List Instance)The instances the uses need, and the ones those need, in the order found.
cpp.Templates.memberType
Section titled “cpp.Templates.memberType”def Templates.memberType (t : TypeSyntax) : TypeSyntaxA member type of a class written by the name of its typedef (C::name, which the class’s lowering declares,
cpp.classes), once the class is known (a template’s instance written as its class first).
cpp.Templates.asClass
Section titled “cpp.Templates.asClass”def Templates.asClass (ct : ClassTemplates) (t : TypeSyntax) : TypeSyntaxA use’s instance written as the class it is (after the defaults are filled).
cpp.Instance.items
Section titled “cpp.Instance.items”def Instance.items (i : Instance) : List ItemAn instance’s items: its class and the hidden typedefs that keep its template arguments (deduction reads them).
cpp.Templates.placed
Section titled “cpp.Templates.placed”def Templates.placed (ct : ClassTemplates) (instances : List Instance) (fuel : Nat) (emitted : List String) (items : List Item) : List Item * List StringThe items with each instance placed before the first item that uses it (and what it uses before it).
cpp.Templates.specialized
Section titled “cpp.Templates.specialized”def Templates.specialized (ct : ClassTemplates) (it : Item) : List ItemThe item it as the program keeps it once its class templates are instantiated: a function template’s explicit
specialization (template <> int f<int>(int)) as the instance it is (named with the class templates ct); a class
template’s parameters alone, its definition an empty class (checking names instances by them,
CppTables.classTemplates); a class template’s specializations dropped (the instances have them); any other as it is.
cpp.Templates.prepare
Section titled “cpp.Templates.prepare”def Templates.prepare (p : Program) : CheckResult Cpp.constructs ProgramA program with its class templates instantiated: each instance a class placed before its first use, the uses naming it; the function templates kept for checking to instantiate.