类模板
<functional>

std::is_bind_expression

template <class T> struct is_bind_expression;
Is bind expression
Trait class that identifies whether T is a bind expression.

It inherits from integral_constant as being either true_type or false_type, depending on whether T is a type returned from bind or not.
It is defined with the same characteristics as either true_type or false_type, depending on whether T is a type returned from bind or not.

The bind function uses this trait to determine whether the type of each of its arguments is a subexpression (i.e., whether it is itself a type returned by bind). Users can specialize this template for types that are to be treated as bind subexpressions.

模板参数

T
一个类型。

成员类型

Inherited from integral_constant
成员类型定义
value_typebool
类型either true_type or false_type
成员类型定义
value_typebool
类型either true_type or false_type (or a type with the same characteristics)

成员常量

成员常量定义
either true or false

成员函数

成员常量定义
operator boolReturns either true or false

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
// is_bind_expression example
#include <iostream>     // std::cout, std::boolalpha
#include <functional>   // std::bind, std::plus, std::placeholders, std::is_bind_expression

int main () {
  using namespace std::placeholders;  // introduces _1
  auto increase_int = std::bind (std::plus<int>(),_1,1);

  std::cout << std::boolalpha;
  std::cout << std::is_bind_expression<decltype(increase_int)>::value << '\n';

  return 0;
}

输出
true


另见