最简单的方法是用一个函数对象。
第一步是定义一个函数对象类型。
在这里展示了首个无类函数对象。
The first class-ness of function objects is clearly demonstrated here. Listing 10 shows what happens when I try calling a garbage method on function blah
头文件定义了函数对象和函数适配器。
The header file defines function objects and function adapters.
类属性中的任何函数对象在类实例中都定义为方法。
Any function object that is a class attribute defines a method for instances of that class.
它具有至少相同的寿命为函数对象(没有什么时髦的)。
It has at least the same lifetime as the function object (absent something funky).
类属性的任何函数对象都为那个类的实例定义了一个方法。
Any function object that is a class attribute defines a method for instances of that class.
Scala是一种函数对象混合的语言,具有一些强大的优点
Scala is a functional-object hybrid language with several powerful factors working in its favor
方法调用通常返回的结果是一个函数对象,然后执行这个函数对象。
In usual cases of method invocation the return result is a function object, which is then executed.
返回的函数使用lambda 结构创建,该结构动态创建新的函数对象。
The returned function is created using the lambda construct, which dynamically creates a new function object.
函数对象:由函数定义所创建的值,函数名字指代了这一函数对象。
A value created by a function definition. The name of the function is a variable that refers to a function object.
然后请注意,在循环体中,我使用callback来调用传递的参数函数对象。
Notice that then, in the body of the loop, I use callback to invoke the passed parameter function object.
首先将函数对象[[scope]]内部属性中的对象,按顺序复制到作用域链中。
The objects in the function object's [[scope]] property are copied into the scope chain in the same order.
它们仅仅是为了保证派生出来的函数对象的参数与返回值具有不同的名字。
They merely ensure that arguments and return values of their derived function objects have uniform names.
闭包捕获真正被调用的Web服务方法存根(称为obj的函数对象)以及流作为日志输出。
The closure captures the information about the actual Web service method stub to be invoked (the function object called obj) as well as the stream for the log output.
不是必须要将函数定义代码写进类定义中,也可以将一个函数对象赋给类中的一个变量。
It is not necessary that the function definition is textually enclosed in the class definition: assigning a function object to a local variable in the class is also ok.
到目前为止,要想使用定制的比较函数,标准的做法是定义自己的函数对象,然后适当地定义操作符。
So far, to use custom comparison functions, the standard practice has been to define your own function object and then define the operator appropriately.
这种情况下返回的函数对象就是一个闭包,其中封装了一些日志代码和最初的函数调用所需要的数据。
In this case the returned function object is a closure which encapsulates some logging code and the data needed to call the original function.
每个函数对象都有一个叫做[[scope]]的内部属性,这个内部属性包含创建函数时的作用域信息。
Each function object has an internal property called [[scope]] that is initialized with information about the scope in which the function was created.
然而,当库允许任意的函数对象隐式地变成插槽时,这里出现了问题,因为插槽不再具有比较性。
However, this presents problems when the library allows arbitrary function objects to implicitly become slots, because slots are no longer comparable.
因为使用Python传递函数对象是如此简单,与其它语言中的相似类比较,这个类所需使用行数非常少。
Because passing function objects in Python is so easy, this class USES far fewer lines than any similar class in another language would require.
函数对象是一个重要的普通程序的一部分,因为他们允许抽象比类型对象还要多,而且比它正在执行的操作还要多。
Function objects are an important part of generic programming because they allow abstraction not only over the types of objects, but also over the operations that are being performed.
函数对象是一个重要的普通程序的一部分,因为他们允许抽象比类型对象还要多,而且比它正在执行的操作还要多。
Function objects are an important part of generic programming because they allow abstraction not only over the types of objects, but also over the operations that are being performed.
应用推荐