Espaços nominais
Variantes
Acções

std::is_placeholder

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

 
 
Biblioteca de utilitários
Digite apoio (basic types, RTTI, type traits)
Gerenciamento de memória dinâmica
De tratamento de erros
Utilidades do programa
Variadic funções
Data e hora
Objetos de função
(C++11)
Os operadores relacionais
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Pares e tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Troque, avançar e avançar
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
 
Objetos de função


Invólucros de função
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.
(C++11)
(C++11)
Ligar
Original:
Bind
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
is_placeholder
(C++11)
Invólucros de referência
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.
(C++11)(C++11)
Invólucros operador
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.
Negadores
Original:
Negators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Obsoleta ligantes e adaptadores
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.
(obsoleta)
(obsoleta)
(obsoleta)
(obsoleta)
(obsoleta)(obsoleta)(obsoleta)(obsoleta)
(obsoleta)
(obsoleta)(obsoleta)
(obsoleta)(obsoleta)
 
Definido no cabeçalho <functional>
template< class T >
struct is_placeholder;
(desde C++11)
Se T é o tipo de um espaço reservado padrão (_1, _2, _3,...), então este modelo é derivado do std::integral_constant<int,1>, std::integral_constant<int,2>, std::integral_constant<int,3>, respectivamente. Se T não é um tipo de espaço reservado padrão, este modelo é derivado do 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.
O modelo pode ser especializado para qualquer tipo definido pelo usuário, que deve ser tratada por std::bind como se fosse um espaço reservado para os argumentos não ligados.
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.

Índice

Herdado de std::integral_constant

Member constants

value
[estática]
placeholder value or 0 for non-placeholder types
(membro estático público constante)

Member functions

operator int
converte o objeto em int, retorna 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.

(função pública membro)

Member types

Tipo
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>

[editar] Exemplo

#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';
}

Saída:

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

[editar] Veja também

(C++11)
se liga um ou mais argumentos para um objeto de função
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.

(modelo de função) [edit]
espaços reservados para os argumentos não ligados em uma expressão de std::bind
Original:
placeholders for the unbound arguments in a std::bind expression
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(constante) [edit]