Espaces de noms
Variantes
Affichages
Actions

std::is_placeholder

De cppreference.com
< cpp‎ | utility‎ | functional

 
 
 
Objets Function
Emballages de fonction
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)
Lier
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)
Emballages de référence
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)
Emballages opérateur
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.
Négateurs
Original:
Negators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Obsolète liants et des adaptateurs
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 (obsolète)
binary_function (obsolète)
ptr_fun (obsolète)
pointer_to_unary_function (obsolète)
pointer_to_binary_function (obsolète)
mem_fun (obsolète)
mem_fun_t
mem_fun1_t
const_mem_fun_t
const_mem_fun1_t
(obsolète)
(obsolète)
(obsolète)
(obsolète)
mem_fun_ref (obsolète)
mem_fun_ref_t
mem_fun1_ref_t
const_mem_fun_ref_t
const_mem_fun1_ref_t
(obsolète)
(obsolète)
(obsolète)
(obsolète)
binder1st
binder2nd
(obsolète)
(obsolète)
bind1st
bind2nd
(obsolète)
(obsolète)
 
Déclaré dans l'en-tête <functional>
template< class T >
struct is_placeholder;
(depuis C++11)
Si T est le type d'un espace réservé standard (_1, _2, _3, ...), puis ce modèle est dérivé de std::integral_constant<int,1>, std::integral_constant<int,2>, std::integral_constant<int,3>, respectivement. Si T n'est pas un type d'espace réservé standard, ce modèle est dérivé de std::integral_constant<int,0> .
Original:
If T is the type of a standard placeholder (_1, _2, _3, ...), then this template is derived from std::integral_constant<int,1>, std::integral_constant<int,2>, std::integral_constant<int,3>, respectively. If T is not a standard placeholder type, this template is derived from std::integral_constant<int,0>.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Le modèle peut être spécialisé pour tout type défini par l'utilisateur qui doit être traitée par std::bind comme s'il s'agissait d'un espace réservé pour les arguments non liés .
Original:
The template may be specialized for any user-defined type which should be treated by std::bind as if it was a placeholder for unbound arguments.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Sommaire

Inherited from std::integral_constant

Member constants

value
[
statique
Original:
static
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
]
placeholder value or 0 for non-placeholder types
(constante membre statique publique)

Member functions

operator int
convertit l'objet en int, retourne value
Original:
converts the object to int, returns value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(fonction membre publique)

Member types

Type d'
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 int
type std::integral_constant<int, value>

[modifier] Exemple

#include <iostream>
#include <type_traits>
#include <functional>
 
struct My_2 {
} my_2;
 
namespace std {
    template<>
    struct is_placeholder<My_2> : public integral_constant<int, 2> {};
}
 
int f(int n1, int n2)
{
    return n1+n2;
}
 
int main()
{
    std::cout << "Standard placeholder _5 is for the argument number "
              << std::is_placeholder<decltype(std::placeholders::_5)>::value
              << '\n';
 
    auto b = std::bind(f, my_2, 2);
    std::cout << "Adding 2 to 11 selected with a custom placeholder gives " 
              << b(10, 11) 
              << '\n';
}

Résultat :

Standard placeholder _5 is for the argument number 5
Adding 2 to 11 selected with a custom placeholder gives 13

[modifier] Voir aussi

(C++11)
liaison de paramètres et application partielle d'un foncteur
(fonction générique) [edit]
placeholders (numéros de paramètre) pour les std::bind
(constante) [edit]