This type of object is known as a functor or function object.
这种类型的对象称为functor或者function object。
Any function object that is a class attribute defines a method for instances of that class.
类属性的任何函数对象都为那个类的实例定义了一个方法。
In usual cases of method invocation the return result is a function object, which is then executed.
方法调用通常返回的结果是一个函数对象,然后执行这个函数对象。
The simplest is to use a function object.
最简单的方法是用一个函数对象。
The first step is to define a function object type.
第一步是定义一个函数对象类型。
Any function object that is a class attribute defines a method for instances of that class.
类属性中的任何函数对象在类实例中都定义为方法。
The returned function is created using the lambda construct, which dynamically creates a new function object.
返回的函数使用lambda 结构创建,该结构动态创建新的函数对象。
A value created by a function definition. The name of the function is a variable that refers to a function object.
函数对象:由函数定义所创建的值,函数名字指代了这一函数对象。
In this case the returned function object is a closure which encapsulates some logging code and the data needed to call the original function.
这种情况下返回的函数对象就是一个闭包,其中封装了一些日志代码和最初的函数调用所需要的数据。
Each function object has an internal property called [[scope]] that is initialized with information about the scope in which the function was created.
每个函数对象都有一个叫做[[scope]]的内部属性,这个内部属性包含创建函数时的作用域信息。
So far, to use custom comparison functions, the standard practice has been to define your own function object and then define the operator appropriately.
到目前为止,要想使用定制的比较函数,标准的做法是定义自己的函数对象,然后适当地定义操作符。
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.
不是必须要将函数定义代码写进类定义中,也可以将一个函数对象赋给类中的一个变量。
However, the method copies a pointer to the selected function into a local variable, and then calls the function with the call method of the function object, rather than calling it directly.
但是,这个方法将所选函数的指针复制到一个局部变量中,然后用function对象的call方法调用这个函数。而不是直接调用它。
However, the method copies a pointer to the selected function into a local variable, and then calls the function with the call method of the function object, rather than calling it directly.
但是,这个方法将所选函数的指针复制到一个局部变量中,然后用function对象的call方法调用这个函数。而不是直接调用它。
应用推荐