Share via


is_placeholder Class

Tests if type is a placeholder.

template<class Ty>
    struct is_placeholder {
    static const int value;
    };

Remarks

The constant value value is 0 if the type Ty is not a placeholder; otherwise, its value is the position of the function call argument that it binds to. You use it to determine the value N for the Nth placeholder _N.

Example

 

// std_tr1__functional__is_placeholder.cpp 
// compile with: /EHsc 
#include <functional> 
#include <iostream> 
 
using namespace std::tr1::placeholders; 
 
void square(double x) 
    { 
    std::cout << x << "^2 == " << x * x << std::endl; 
    } 
 
template<class Expr> 
    void test_for_placeholder(const Expr&) 
    { 
    std::cout << std::tr1::is_placeholder<Expr>::value << std::endl; 
    } 
 
int main() 
    { 
    test_for_placeholder(3.0); 
    test_for_placeholder(_3); 
 
    return (0); 
    } 
 

0 3

Requirements

Header: <functional>

Namespace: std::tr1

See Also

Reference

<functional> (TR1)

_1 Object