userconversions
cpp.UserConversion.parameters
Section titled “cpp.UserConversion.parameters”def UserConversion.parameters (g : Globals Cpp.constructs) (c : Constructor) : List (Ty Cpp.constructs)A constructor’s parameters after this.
cpp.UserConversion.referred
Section titled “cpp.UserConversion.referred”def UserConversion.referred (t : Ty Cpp.constructs) : Ty Cpp.constructsWhat a reference parameter refers to, else the parameter’s type.
cpp.UserConversion.referredAsWritten
Section titled “cpp.UserConversion.referredAsWritten”def UserConversion.referredAsWritten (t : Ty Cpp.constructs) : Ty Cpp.constructsWhat a reference parameter refers to, its const kept (a const reference binds an rvalue too).
cpp.UserConversion.reference
Section titled “cpp.UserConversion.reference”def UserConversion.reference (t : Ty Cpp.constructs) : Option BoolWhether a parameter is a reference: none if not, else whether it is an rvalue reference.
cpp.UserConversion.isExact
Section titled “cpp.UserConversion.isExact”def UserConversion.isExact (c : Constructor * (Bool * Lifted Cpp.constructs)) : BoolWhether a converting constructor takes exactly the value’s type.
cpp.UserConversion.made
Section titled “cpp.UserConversion.made”def UserConversion.made (g : Globals Cpp.constructs) (extended : Bool) (target : Ty Cpp.constructs) (node : NodeId) (c : Constructor * (Bool * Lifted Cpp.constructs)) : CheckResult Cpp.constructs (Lifted Cpp.constructs)The temporary a converting constructor makes from the converted argument (named after the value’s node; one a declared reference binds to is named, so it lives as long as the reference).
cpp.UserConversion.toClass
Section titled “cpp.UserConversion.toClass”def UserConversion.toClass (rules : Rules) (types : TypeExtension Cpp.constructs) (extended : Bool) (g : Globals Cpp.constructs) (n : NodeId) (t : Ty Cpp.constructs) (e : TypedExpr Cpp.constructs) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))A value converted to a class by its converting constructor: a temporary of the class (named after the value’s node, so a declaration it initializes takes it as the object itself; one a declared reference is bound to lives as long as the reference, [class.temporary]p6). None when the value is of the class, or no converting constructor takes it.
cpp.UserConversion.functionName
Section titled “cpp.UserConversion.functionName”def UserConversion.functionName (t : Ty Cpp.constructs) : Option StringThe name of the conversion function to the type t, as written (operator double; a class by its name, so no class
template’s defaults are needed).
cpp.UserConversion.functionsOf
Section titled “cpp.UserConversion.functionsOf”def UserConversion.functionsOf (cls : ClassMembers) : List ClassMemberThe conversion functions of a class (its members named operator T), with whether each is explicit.
cpp.UserConversion.fromClass
Section titled “cpp.UserConversion.fromClass”def UserConversion.fromClass (rules : Rules) (types : TypeExtension Cpp.constructs) (contextual : Bool) (g : Globals Cpp.constructs) (n : NodeId) (t : Ty Cpp.constructs) (e : TypedExpr Cpp.constructs) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))An object of a class converted to a type that is not a class by a conversion function (explicit ones too when contextual, or in a cast): the call’s value, converted as usual. None when the object is not of a class, the type is one, or the object’s class has no such function.
cpp.UserConversion.anyConverts
Section titled “cpp.UserConversion.anyConverts”def UserConversion.anyConverts (g : Globals Cpp.constructs) : BoolWhether some class has a conversion function (none: no operand to convert, and none to check).
cpp.UserConversion.cast
Section titled “cpp.UserConversion.cast”def UserConversion.cast (rules : Rules) (types : TypeExtension Cpp.constructs) (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (n : NodeId) (t : TypeSyntax) (a : Expr) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))A cast with a user-defined conversion: to a class, the class’s construction from the value ([expr.cast]p4: a static_cast, explicit constructors too); of an object of a class to another type, its conversion function’s value ([expr.static.cast]p4, explicit ones too).
cpp.UserConversion.expression
Section titled “cpp.UserConversion.expression”def UserConversion.expression (rules : Rules) (types : TypeExtension Cpp.constructs) (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (e : Expr) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))An assignment to an object of a class without operator= (assigned bit for bit) from a value a converting
constructor takes: from the temporary it makes; an operator on an object of a class without an operator function for
it: on its one conversion function’s value; a cast to a class: the class’s construction; ! of an object of a class
without operator!: of its conversion to bool ([expr.unary.op]p9, contextual).