Пространства имён
Варианты
Действия

std::is_bind_expression

Материал из cppreference.com

 
 
 
Функция объектов
Функция обертки
Original:
Function wrappers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
function(C++11)
mem_fn(C++11)
bad_function_call(C++11)
Привязка
Original:
Bind
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
bind(C++11)
is_bind_expression(C++11)
is_placeholder(C++11)
_1, _2, _3, ...(C++11)
Ссылка обертки
Original:
Reference wrappers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
reference_wrapper(C++11)
ref
cref
(C++11)
(C++11)
Оператор обертки
Original:
Operator wrappers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Negators
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:
Deprecated binders and adaptors
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
unary_function(устарело)
binary_function(устарело)
ptr_fun(устарело)
pointer_to_unary_function(устарело)
pointer_to_binary_function(устарело)
mem_fun(устарело)
mem_fun_t
mem_fun1_t
const_mem_fun_t
const_mem_fun1_t
(устарело)
(устарело)
(устарело)
(устарело)
mem_fun_ref(устарело)
mem_fun_ref_t
mem_fun1_ref_t
const_mem_fun_ref_t
const_mem_fun1_ref_t
(устарело)
(устарело)
(устарело)
(устарело)
binder1st
binder2nd
(устарело)
(устарело)
bind1st
bind2nd
(устарело)
(устарело)
 
Заголовочный файл <functional>
template< class T >
struct is_bind_expression;
(начиная с C++11)
Если T это тип производится с помощью вызова std::bind, этот шаблон обеспечивает постоянный член value равных true. Для любого другого типа, value является false.
Original:
If T is the type produced by a call to std::bind, this template provides the member constant value equal true. For any other type, value is false.
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:
This template may be specialized for a user-defined type which should be treated by std::bind as if it was the type of a bind subexpression: when a bind-generated function object is invoked, a bound argument of this type will be invoked as a function object and will be given all the unbound arguments passed to the bind-generated object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Содержание

Унаследован от std::integral_constant

Member constants

value
[static]
true если T is a function object generated by std::bind, false иначе
Original:
true if T is a function object generated by std::bind, false otherwise
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(public static константа-член)

Member functions

operator bool
преобразует объект в bool, возвращает value
Original:
converts the object to bool, returns value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(public функция-член)

Member types

Type
Original:
Type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
value_type bool
type std::integral_constant<bool, value>

[править] Пример

#include <iostream>
#include <type_traits>
#include <functional>
 
struct MyBind {
    typedef int result_type;
    int operator()(int a, int b) const { return a + b; }
};
 
namespace std {
    template<>
    struct is_bind_expression<MyBind> : public true_type {};
}
 
int f(int n1, int n2)
{
    return n1+n2;
}
 
int main()
{
    // as if bind(f, bind(MyBind::operator(), _1, _2), 2)
    auto b = std::bind(f, MyBind(), 2);
 
    std::cout << "Adding 2 to the sum of 10 and 11 gives " << b(10, 11) << '\n';
}

Вывод:

Adding 2 to the sum of 10 and 11 gives 23

[править] См. также

(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.

(шаблон функции) [edit]