Function objects
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
A“函数对象”的函数调用操作符的定义是任何对象。 C + +提供了许多内置的函数对象,以及支持新的函数对象的创建和操纵的.....
Original:
A function object is any object for which the function call operator is defined. C++ provides many built-in function objects as well as support for creation and manipulation of new function objects.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 多态函数包装
std::function提供了用于存储任意的函数对象的支持.
Original:
std::function provides support for storing arbitrary function objects.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| (C++11) |
包装任何类型的可调用对象与指定的函数调用签名 Original: wraps callable object of any type with specified function call signature The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
创建一个函数对象的指针的成员 Original: creates a function object out of a pointer to a member The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
| (C++11) |
调用一个空的std::function时抛出的异常 Original: the exception thrown when invoking an empty std::function The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) |
[编辑] 绑定
std::bind提供支持部分功能的应用,即绑定函数的参数,以产生新的功能.
Original:
std::bind provides support for 部分功能的应用, i.e. binding arguments to functions to produce new functions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| (C++11) |
绑定一个或多个参数的函数对象 Original: binds one or more arguments to a function object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
| (C++11) |
指示一个对象是 std::bind表达或者可以用作一个 Original: indicates that an object is std::bind expression or can be used as one The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) |
指示一个对象是一个标准的占位符或可以用作1 Original: indicates that an object is a standard placeholder or can be used as one The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| Defined in namespace
std::placeholders | |
| (C++11) |
std::bind表达在未绑定的参数的占位符 Original: placeholders for the unbound arguments in a std::bind expression The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (不变) |
[编辑] 参考包装
参考包装使存储在复制的函数对象的引用参数
Original:
Reference wrappers allow reference arguments to be stored in copyable function objects:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| (C++11) |
CopyConstructible和CopyAssignable参考包装 Original: CopyConstructible and CopyAssignable reference wrapper The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (C++11) (C++11) |
创建一个std::reference_wrapper推导出它的参数类型 Original: creates a std::reference_wrapper with a type deduced from its argument The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
[编辑] 函数对象
C + +函数对象定义了几个常见的算术和逻辑运算
Original:
C++ defines several function objects that represent common arithmetic and logical operations:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Original: Arithmetic operations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 函数对象实施x + y Original: function object implementing x + y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x - y Original: function object implementing x - y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x * y Original: function object implementing x * y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x / y Original: function object implementing x / y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x % y Original: function object implementing x % y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施-x Original: function object implementing -x The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
Original: Comparisons The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 函数对象实施x == y Original: function object implementing x == y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x != y Original: function object implementing x != y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x > y Original: function object implementing x > y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x < y Original: function object implementing x < y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x >= y Original: function object implementing x >= y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x <= y Original: function object implementing x <= y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
Original: Logical operations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 函数对象实施x && y Original: function object implementing x && y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x || y Original: function object implementing x || y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施!x Original: function object implementing !x The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
Original: Bitwise operations The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 函数对象实施x & y Original: function object implementing x & y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x | y Original: function object implementing x | y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 函数对象实施x ^ y Original: function object implementing x ^ y The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
Original: Negators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 包装函数对象返回的补一元谓词其持有的 Original: wrapper function object returning the complement of the unary predicate it holds The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 包装函数对象返回的补其所持有的二元谓词 Original: wrapper function object returning the complement of the binary predicate it holds The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 构造自定义std::unary_negate对象 Original: constructs custom std::unary_negate object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) | |
| 构造自定义std::binary_negate对象 Original: constructs custom std::binary_negate object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) | |
[编辑] 不推荐在C + +11
已被弃用的几个实用工具,提供了早期功能支持在C + +11
Original:
Several utilities that provided early functional support are deprecated in C++11:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Original: Base The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (过时了) |
适配器兼容的一元函数的基类 Original: adaptor-compatible unary function base class The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (过时了) |
适配器兼容的二元函数的基类 Original: adaptor-compatible binary function base class The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
Original: Binders The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| (过时了) (过时了) |
函数对象的一个二元函数和它的参数之一 Original: function object holding a binary function and one of its arguments The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (过时了) (过时了) |
一个参数绑定到一个二元函数 Original: binds one argument to a binary function The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
Original: Function adaptors The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | |
| 适配器兼容的包装,一元函数的指针 Original: adaptor-compatible wrapper for a pointer to unary function The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| 适配器兼容的封装为一个二元函数的指针 Original: adaptor-compatible wrapper for a pointer to binary function The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
| (过时了) |
创建适配器兼容功能的包装对象从一个指针到函数 Original: creates an adaptor-compatible function object wrapper from a pointer to function The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
| (过时了) (过时了) (过时了) (过时了) |
包装为一个无参的成员函数,调用一个指向对象的指针的指针 Original: wrapper for a pointer to nullary member function, callable with a pointer to object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (过时了) |
从一个指针成员函数创建一个包装,一个指向对象的指针调用 Original: creates a wrapper from a pointer to member function, callable with a pointer to object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
| (过时了) (过时了) (过时了) (过时了) |
wapper一个无参或一元成员函数的指针,调用的参考对象 Original: wapper for a pointer to nullary or unary member function, callable with a reference to object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
| (过时了) |
从一个指针成员函数创建一个包装,赎回的参考对象 Original: creates a wrapper from a pointer to member function, callable with a reference to object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |