Defined Terms
术语
- allocator class(allocator 类)
-
Standard library class that supports type-specific allocation of raw, unconstructed memory. The allocator class is a class template that defines member functions to allocate, deallocate, construct, and destroy objects of the allocator's template parameter type.
标准库类,支持原始未构造内存的类特定的分配。allocator 类是一个类模板,定义了成员函数,对 allocator 的模板形参类型的对象进行 allocate、deallocate、construct 和 destroy。
- anonymous union(匿名联合)
-
Unnamed union that is not used to define an object. Members of the anonymous union are referred to directly. These unions may not have member functions and may not have private or protected members.
不用于定义对象的未命名联合。直接引用匿名联合的成员。这些联合不能具有成员函数,也不能具有私有或受保护成员。
- bit-field(位域)
-
Class member with an signed or unsigned integral type that specifies the number of bits to allocate to the member. Bit-fields defined in consecutive order in the class are, if possible, compacted into a common integral value.
有符号或无符号整型类成员,它指定了分配给成员的位数。如果可能,将类中以连续次序定义的位域压缩到公共整型值中。
- delete expression(delete 表达式)
-
A delete expression destroys a dynamically allocated object of a specified type and frees the memory used by that object. A delete[] expression destroys the elements of a dynamically allocated array of a specified type and frees the memory used by the array. These expressions use the corresponding version of the library or class-specific operator delete functions to free raw memory that held the object or array.
delete 表达式撤销特定类型的动态分配对象,并释放该对象所用的内存。delete[] 表达式撤销特定类型动态分配数组的元素,并释放数组使用的内存。这些表达式使用库函数或类特定的 operator delete 函数的对应版本来释放保存对象或数组的原始内存。
- discriminant(判别式)
-
Programming technique that uses an object to determine which actual type is held in a union at any given time.
一种编程技术,使用对象来确定任意给定时刻联合中保存的实际类型。
- dynamic_cast
-
Operator that performs a checked cast from a base type to a derived type. The base type must define at least one virtual function. The operator checks the dynamic type of the object to which the reference or pointer is bound. If the object type is the same as the type of the cast (or a type derived from that type), then the cast is done. Otherwise, a zero pointer is returned for a pointer cast, or an exception is thrown for a cast of a reference.
执行从基类类型到派生类型的带检查强制转换的操作符。基类类型必须定义至少一个 virtual 函数。这个操作符检查引用或指针所绑定对象的动态类型。如果对象类型与转换的类型(或者从该类型派生的类型)相同,则进行转换;否则,指针转换返回 0 指针,引用的转换抛出一个异常。
- freelist(自由列表)
-
Memory management technique that involves preallocating unconstructed memory to hold objects that will be created as needed. When objects are freed, their memory is put back on the free list rather than being returned to the system.
一种内存管理技术,涉及预先分配未构造内存以保存在需要时创建的对象。释放对象的时候,将它们的内在放回自由列表,而不是返还给系统。
- linkage directive(链接指示)
-
Mechanism used to allow functions written in a different language to be called from a C++ program. All compilers must support calling C and C++ functions. It is compiler-dependent whether any other languages are supported.
一种机制,用于允许从 C++ 程序调用以不同语言编写的函数。所有编译器都支持调用 C 和 C++ 函数,是否支持任何其他语言随编译器而定。
- local class(局部类)
-
Class defined inside a function. A local class is visible only inside the function in which it is defined. All members of the class must be defined inside the class body. There can be no static members of a local class. Local class members may not access the local variables defined in the enclosing function. They may use type names, static variables, or enumerators defined in the enclosing function.
在函数内部定义的类。局部类只在定义它的函数内部可见,类的所有成员必须定义在类定义体内部。局部类不能有静态成员,局部类成员不能访问外围函数中定义的局部变量,它们可以使用外围函数中定义的类型名、静态变量和枚举成员。
- member operators new and delete(成员操作符 new 和 delete)
-
Class member functions that override the default memory allocation performed by the global library operator new and operator delete functions. Both object (new) and array (new[]) forms of these functions may be defined. The member new and delete functions are implicitly declared as static. These operators allocate (deal-locate) memory. They are used automatically by new (delete) expressions, which handle object initialization and destruction.
类成员函数,覆盖由全局库函数 operator new 和 operator delete 执行的默认内存分配。可以定义这些函数的对象形式(new)和数组形式(new[])。成员 new 和 delete 函数隐式声明为 static,这些操作符分配(释放)内存,它们由 new(delete)表达式自动使用,new(delete)表达式处理对象初始化和撤销。
- nested class(嵌套类)
-
Class defined inside another class. A nested class is defined inside its enclosing scope: Nested-class names must be unique within the class scope in which they are defined but can be reused in scopes outside the enclosing class. Access to the nested class outside the enclosing class requires use of the scope operator to specify the scope(s) in which the class is nested.
在其他类内部定义的类。嵌套类定义在其外围作用域内部:嵌套类名字必须在定义它们的类作用域 中唯一,但可以在外围类之外的作用域中重用。在外围类之外访问嵌套类需要使用作用域操作符指定包含嵌套类的作用域。
- nested type(嵌套类型)
-
Synonym for nested class.
嵌套类的同义词。
- new expression(new 表达式)
-
A new expression allocates and constructs an object of a specified type. A new[] expression allocates and constructs an array of objects. These expressions use the corresponding version of the library operator new functions to allocate raw memory in which the expression constructs an object or array of the specified type.
new 表达式分配和构造特定类型的对象。new[] 表达式分配和构造对象数组。这些表达式使用库函数 operator new 的对应版本分配原始内存,并在该内存中构造特定类型的对象或数组。
- operator delete
-
A library function that frees untyped, unconstructed memory allocated by operator new. The library operator delete[] frees memory used to hold an array that was allocated by operator new[].
释放由 operator new 分配的未类型化的未构造内存的库函数。库函数 operator delete[] 释放由 operator new[] 分配的用于保存数组的内存。
- operator new
-
A library function that allocates untyped, unconstructed memory of a given size. The library function operator new[] allocates raw memory for arrays. These library functions provide a more primitive allocation mechanism than the library allocator class. Modern C++ programs should use the allocator classes rather than these library functions.
一个库函数,它分配给定大小未类型化的未构造内存。库函数 operator new[] 为数组分配原始内存。这些库函数提供了比库类 allocator 更基本的分配机制。现代 C++ 程序应使用 allocator 类而不是这些库函数。
- placement new expression(定位 new 表达式)
-
The form of new that constructs its object in specified memory. It does no allocation; instead, it takes an argument that specifies where the object should be constructed. It is a lower-level analog of the behavior provided by the construct member of the allocator class.
在特定内存中构造对象的 new 的形式。它不进行分配,相反,它接受指定在何处构造对象的实参。它是对 allocator 类的 construct 成员所提供的行为的低级模拟。
- pointer to member(成员指针)
-
Pointer that encapsulates the class type as well as the member type to which the pointer points. The definition of a pointer to member must specify the class name as well as the type of the member(s) to which the pointer may point:
封装类类型以及指针所指向的成员类型的指针。成员指针的定义必须指定类名以及指针可以指向的成员的类型:
TC::*pmem = &C::member;
This statement defines pmem as a pointer that can point to members of the class named C that have type T and initializes it to point to the member in C named member. When the pointer is dereferenced, it must be bound to an object of or pointer to type C:
这个语句将 pmem 定义为指针,它可以指向名为 C 的类的类型为 T 的成员,并将 pmem 初始化为 C 中名为 member 的成员。对该指针解引用的时候,它必须是绑定到类型 C 的对象或指向类型 C 的指针:
classobj.*pmem;
classptr->*pmem;
fetches member from the object classobj of the object pointed to by classptr.
从 classptr 所指对象的 classobj 对象获取 member。
- portable(可移植的)
-
Term used to describe a program that can be moved to a new machine with relatively little effort.
一个用来描述用相对较少的努力就可以移到新机器的程序的术语。
- run-time type identification(运行时类型识别)
-
Term used to describe the language and library facilities that allow the dynamic type of a reference or pointer to be obtained at run time. The RTTI operators, typeid and dynamic_cast, provide the dynamic type only for references or pointers to class types with virtual functions. When applied to other types, the type returned is the static type of the reference or pointer.
用来描述语言和库设施的术语,这种设施允许在运行时获得引用或指针的动态类型。RTTI 操作符 typeid 和 dynamic_cast 只为带虚函数的类类型提供动态类型,应用于其他类型的时候,返回引用或指针的静态类型。
- typeid
-
Unary operator that takes an expression and returns a reference to an object of the library type named type_info that describes the type of the expression. When the expression is an object of a type that has virtual functions, then the dynamic type of the expression is returned. If the type is a reference, pointer, or other type that does not define virtual functions, then the type returned is the static type of the reference, pointer, or object.
一元操作符,接受一个表达式,并返回描述表达式类型的名为 type_info 的库类型的对象引用。如果表达式是具有虚函数的类型的对象,就返回表达式的动态类型;如果该类型是没有定义虚函数的引用、指针或其他类型,就返回引用、指针或对象的静态类型。
- type_info
-
Library type that describes a type. The type_info class is inherently machine-dependent, but any library must define type_info with members listed in Table 18.2 (p. 779). type_info objects may not be copied.
描述类型的库类型。type_info 类是固有机器相关的,但任何库都必须定义带有表 18.2 中所列出成员的 type_info。type_info 对象不能复制。
- union(联合)
-
Classlike aggregate type that may define multiple data members, only one of which can have a value at any one point. Members of a union must be simple types: They can be a built-in or compound type or a class type that does not define a constructor, destructor, or the assignment operator. Unions may have member functions, including constructors and destructors. A union may not serve as a base class.
类形式的聚合类型,它可以定义多个数据成员,但在任意点只有一个成员可以具有值。联合的成员必须为简单类型:内置类型,复合类型,没有定义构造函数、析构函数或赋值操作符的类类型。联合可以有成员函数,包括构造函数和析构函数。联合不能作基类使用。
- volatile
-
Type qualifier that signifies to the compiler that a variable might be changed outside the direct control of the program. It is a signal to the compiler that it may not perform certain optimizations.
类型限定符,告诉编译器可以在程序的直接控制之外改变一个变量。它是告诉编译器不能执行某些优化的信号。
|