Team LiB
Previous Section Next Section

Defined Terms

术语

ambiguous call(有二义性的调用)

Compile-time error that results when there is not a single best match for a call to an overloaded function.

一种编译错误,当调用重载函数,找不到唯一的最佳匹配时产生。

arguments(实参)

Values supplied when calling a function. These values are used to initialize the corresponding parameters in the same way that variables of the same type are initialized.

调用函数时提供的值。这些值用于初始化相应的形参,其方式类似于初始化同类型变量的方法。

automatic objects(自动对象)

Objects that are local to a function. Automatic objects are created and initialized anew on each call and are destroyed at the end of the block in which they are defined. They no longer exist once the function terminates.

局部于函数的对象。自动对象会在每一次函数调用时重新创建和初始化,并在定义它的函数块结束时撤销。一旦函数执行完毕,这些对象就不再存在了。

best match(最佳匹配)

The single function from a set of overloaded functions that has the best match for the arguments of a given call.

在重载函数集合里找到的与给定调用的实参达到最佳匹配的唯一函数。

call operator(调用操作符)

The operator that causes a function to be executed. The operator is a pair of parentheses and takes two operands: The name of the function to call and a (possibly empty) comma-separated list of arguments to pass to the function.

使函数执行的操作符。该操作符是一对圆括号,并且有两个操作数:被调用函数的名字,以及由逗号分隔的(也可能为空)形参表。

candidate functions(候选函数)

The set of functions that are considered when resolving a function call. The candidate functions are all the functions with the name used in the call for which a declaration is in scope at the time of the call.

在解析函数调用时考虑的函数集合。候选函数包括了所有在该调用发生的作用域中声明的、具有该调用所使用的名字的函数。

const member function(常量成员函数)

Function that is member of a class and that may be called for const objects of that type. const member functions may not change the data members of the object on which they operate.

类的成员函数,并可以由该类类型的常量对象调用。常量成员函数不能修改所操纵的对象的数据成员。

constructor(构造函数)

Member function that has the same name as its class. A constructor says how to initialize objects of its class. Constructors have no return type. Constructors may be overloaded.

与所属类同名的类成员函数。构造函数说明如何初始化本类的对象。构造函数没有返回类型,而且可以重载。

constructor initializer list(构造函数初始化列表)

List used in a constructor to specify initial values for data members. The initializer list appears in the definition of a constructor between the parameter list and the constructor body. The list consists of a colon followed by a comma-separated list of member names, each of which is followed by that member's initial value in parentheses.

在构造函数中用于为数据成员指定初值的表。初始化列表出现在构造函数的定义中,位于构造函数体与形参表之间。该表由冒号和冒号后面的一组用逗号分隔的成员名组成,每一个成员名后面跟着用圆括号括起来的该成员的初值。

default constructor(默认构造函数)

The constructor that is used when no explicit initializer is supplied. The compiler will synthesize a default constructor if the class defines no other constructors.

在没有显式提供初始化式时调用的构造函数。如果类中没有定义任何构造函数,编译器会自动为这个类合成默认构造函数。

function(函数)

A callable unit of computation.

可调用的计算单元。

function body(函数体)

Block that defines the actions of a function.

定义函数动作的语句块。

function matching(函数匹配)

Compiler process by which a call to an overloaded function is resolved. Arguments used in the call are compared to the parameter list of each overloaded function.

确定重载函数调用的编译器过程。调用时使用的实参将与每个重载函数的形参表作比较。

function prototype(函数原型)

Synonym for function declaration. The name, return type, and parameter types of a function. To call a function, its prototype must have been declared before the point of call.

函数声明的同义词。包括了函数的名字、返回类型和形参类型。调用函数时,必须在调用点之前声明函数原型。

inline function(内联函数)

Function that is expanded at the point of call, if possible. Inline functions avoid the normal function-calling overhead by replacing the call by the function's code.

如果可能的话,将在调用点展开的函数。内联函数直接以函数代码替代了函数调用点展开的函数。内联函数直接以函数代码替代了函数调用语句,从而避免了一般函数调用的开销。

local static objects(局部静态对象)

Local object that is created and initialized once before the function is first called and whose value persists across invocations of the function.

在函数第一次调用前就已经创建和初始化的局部对象,其值在函数的调用之间保持有效。

local variables(局部变量)

Variables defined inside a function. Local variables are accessible only within the function body.

在函数内定义的变量,仅能在函数体内访问。

object lifetime(对象生命期)

Every object has an associated lifetime. Objects that are defined inside a block exist from when their definition is encountered until the end of the block in which they are defined. Local static objects and global objects defined outside any function are created during program startup and are destroyed when the main function ends. Dynamically created objects that are created through a new expression exist until the memory in which they were created is freed through a corresponding delete.

每个对象皆有与之关联的生命期。在块中定义的对象从定义时开始存在,直到它的定义所在的语句块结束为止。静态局部对象和函数外定义的全局变量则在程序开始执行时创建,当 main 函数结束时撤销。动态创建的对象由 new 表达式创建,从此开始存在,直到由相应的 delete 表达式释放所占据的内存空间为止。

overload resolution(重载确定)

A synonym for function matching.

函数匹配的同义词。

overloaded function(重载函数)

A function that has the same name as at least one other function. Overloaded functions must differ in the number or type of their parameters.

和至少一个其他函数同名的函数。重载函数必须在形参的个数或类型上有所不同。

parameters(形参)

Variables local to a function whose initial values are supplied when the function is called.

函数的局部变量,其初值由函数调用提供。

recursive function(递归函数)

Function that calls itself directly or indirectly.

直接或间接调用自己的函数。

return type(返回类型)

The type of the value returned from a function.

函数返回值的类型。

synthesized default constructor(合成默认构造函数)

If there are no constructors defined by a class, then the compiler will create (synthesize) a default constructor. This constructor default initializes each data member of the class.

如果类没有定义任何构造函数,则编译器会为这个类创建(合成)一个默认构造函数。该函数以默认的方式初始化类中的所有数据成员。

temporary object(临时对象)

Unnamed object automatically created by the compiler in the course of evaluating an expression. The phrase temporary object is usually abreviated as temporary. A temporary persists until the end of the largest expression that encloses the expression for which it was created.

在求解表达式的过程中由编译器自动创建的没有名字的对象。“临时对象”这个术语通常简称为“临时”。临时对象一直存在直到最大表达式结束为止,最大表达式指的是包含创建该临时对象的表达式的最大范围内的表达式。

this pointer(this 指针)

Implicit parameter of a member function. this points to the object on which the function is invoked. It is a pointer to the class type. In a const member function the pointer is a pointer to const.

成员函数的隐式形参。this 指针指向调用该函数的对象,是指向类类型的指针。在 const 成员函数中,该指针也指向 const 对象。

viable functions(可行函数)

The subset of overloaded functions that could match a given call. Viable functions have the same number of parameters as arguments to the call and each argument type can potentially be converted to the corresponding parameter type.

重载函数中可与指定的函数调用匹配的子集。可行函数的形参个数必须与该函数调用的实参个数相同,而且每个实参类型都可潜在地转换为相应形参的类型。

Team LiB
Previous Section Next Section