TemplateDeclaration

extern (C++) final
class TemplateDeclaration : ScopeDsymbol {
TemplateParameters* parameters;
TemplateParameters* origParameters;
Expression constraint;
TemplateInstance[TemplateInstanceBox] instances;
TemplateDeclaration overnext;
TemplateDeclaration overroot;
FuncDeclaration funcroot;
Dsymbol onemember;
bool literal;
bool ismixin;
bool isstatic;
Visibility visibility;
TemplatePrevious* previous;
__gshared
debug(FindExistingInstance)
uint nFound;
__gshared
debug(FindExistingInstance)
uint nNotFound;
__gshared
debug(FindExistingInstance)
uint nAdded;
__gshared
debug(FindExistingInstance)
uint nRemoved;
}

Members

Functions

addInstance
TemplateInstance addInstance(TemplateInstance ti)

Add instance ti to TemplateDeclaration's table of instances. Return a handle we can use to later remove it if it fails instantiation.

declareParameter
RootObject declareParameter(Scope* sc, TemplateParameter tp, RootObject o)

Declare template parameter tp with value o, and install it in the scope sc.

deduceFunctionTemplateMatch
MATCHpair deduceFunctionTemplateMatch(TemplateInstance ti, Scope* sc, FuncDeclaration fd, Type tthis, ArgumentList argumentList)

Match function arguments against a specific template function. Input: ti sc instantiation scope fd tthis 'this' argument if !NULL argumentList arguments to function Output: fd Partially instantiated function declaration ti.tdtypes Expression/Type deduced template arguments

doHeaderInstantiation
FuncDeclaration doHeaderInstantiation(TemplateInstance ti, Scope* sc2, FuncDeclaration fd, Type tthis, Expressions* fargs)

Limited function template instantiation for using fd.leastAsSpecialized()

evaluateConstraint
bool evaluateConstraint(TemplateInstance ti, Scope* sc, Scope* paramscope, Objects* dedargs, FuncDeclaration fd)

Check to see if constraint is satisfied.

findExistingInstance
TemplateInstance findExistingInstance(TemplateInstance tithis, Expressions* fargs)

Given a new instance tithis of this TemplateDeclaration, see if there already exists an instance. If so, return that existing instance.

getConstraintEvalError
const(char)* getConstraintEvalError(const(char)* tip)

Destructively get the error message from the last constraint evaluation

isOverloadable
bool isOverloadable()

We can overload templates.

isVariadic
TemplateTupleParameter isVariadic()

Check if the last template parameter is a tuple one, and returns it if so, else returns null.

leastAsSpecialized
MATCH leastAsSpecialized(Scope* sc, TemplateDeclaration td2, ArgumentList argumentList)

Determine partial specialization order of 'this' vs td2.

matchWithInstance
MATCH matchWithInstance(Scope* sc, TemplateInstance ti, Objects* dedtypes, ArgumentList argumentList, int flag)

Given that ti is an instance of this TemplateDeclaration, deduce the types of the parameters to this, and store those deduced types in dedtypes[]. Input: flag 1: don't do semantic() because of dummy types 2: don't change types in matchArg() Output: dedtypes deduced arguments Return match level.

overloadInsert
bool overloadInsert(Dsymbol s)

Overload existing TemplateDeclaration 'this' with the new one 's'. Return true if successful; i.e. no conflict.

removeInstance
void removeInstance(TemplateInstance ti)

Remove TemplateInstance from table of instances. Input: handle returned by addInstance()

scopeForTemplateParameters
Scope* scopeForTemplateParameters(TemplateInstance ti, Scope* sc)

Create a scope for the parameters of the TemplateInstance ti in the parent scope sc from the ScopeDsymbol paramsym.

toCharsNoConstraints
const(char)* toCharsNoConstraints()

Similar to toChars, but does not print the template constraints

Variables

deprecated_
bool deprecated_;

this template declaration is deprecated

isTrivialAlias
bool isTrivialAlias;

matches pattern template Alias(T) { alias Alias = qualifiers(T); }

isTrivialAliasSeq
bool isTrivialAliasSeq;

matches pattern template AliasSeq(T...) { alias AliasSeq = T; }

Inherited Members

From ScopeDsymbol

search
Dsymbol search(Loc loc, Identifier ident, int flags)

This function is #1 on the list of functions that eat cpu time. Be very, very careful about slowing it down.

getImportedScopes
Dsymbols* getImportedScopes()
getImportVisibilities
Visibility.Kind[] getImportVisibilities()
findGetMembers
FuncDeclaration findGetMembers()

Look for member of the form: const(MemberInfo)[] getMembers(string); Returns NULL if not found

symtabInsert
Dsymbol symtabInsert(Dsymbol s)

Insert Dsymbol in table.

symtabLookup
Dsymbol symtabLookup(Dsymbol s, Identifier id)

Look up identifier in symbol table.

hasStaticCtorOrDtor
bool hasStaticCtorOrDtor()

Return true if any of the members are static ctors or static dtors, or if any members have members that are.

_foreach
int _foreach(Scope* sc, Dsymbols* members, ForeachDg dg, size_t* pn)

Expands attribute declarations in members in depth first order. Calls dg(size_t symidx, Dsymbol *sym) for each member. If dg returns !=0, stops and returns that value else returns 0. Use this function to avoid the O(N + N^2/2) complexity of calculating dim and calling N times getNth.

Meta