class template
<functional>

std::is_placeholder

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

It inherits from integral_constant<int,I>, where I is the placeholder's order number (1 for _1, 2 for _2, ...) if T is the type of a bind placeholder, or zero (0) if it is not.
It is defined as if it inherited from integral_constant<int,I>, where I is the placeholder's order number (1 for _1, 2 for _2, ...) if T is the type of a bind placeholder, or zero (0) if it is not.

The bind function uses this trait to determine whether the type of each of its arguments is a placeholder. Users can specialize this template for types that are to be treated as placeholders.

Template parameters

T
A type.

Member types

Inherited from integral_constant:
member typedefinition
value_typeint
typeThe integral_constant type it inherits.
member typedefinition
value_typeint
typeThe integral_constant type it inherits, or a type with the same characteristics.

Member constants

member constantdefinition
valueIf T is the type of a placeholder: the placeholder's order number (1 for _1, 2 for _2, ...).
Otherwise: 0.

Member functions

member constantdefinition
operator intReturns the member constant value

Example

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

int main () {
  using namespace std::placeholders;  // introduces _1

  std::cout << std::is_placeholder<decltype(_1)>::value << '\n';
  std::cout << std::is_placeholder<decltype(_2)>::value << '\n';
  std::cout << std::is_placeholder<int>::value << '\n';

  return 0;
}

Output:
1
2
0


See also