Espaces de noms
Variantes
Actions

std::not1

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.
not1
not2
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 Predicate >
std::unary_negate<Predicate> not1(const Predicate& pred);
not1 est une fonction d'assistance pour créer un objet fonction qui renvoie le complément de la fonction de prédicat unaire passé. L'objet créé est fonction du type de std::unary_negate<Predicate> .
Original:
not1 is a helper function to create a function object that returns the complement of the unary predicate function passed. The function object created is of type std::unary_negate<Predicate>.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Le type de relation unaire doit définir un type d'élément, argument_type, qui est convertible en type de paramètre du prédicat. Les objets de fonction unaires obtenus à partir std::ref, std::cref, std::negate, std::logical_not, std::mem_fn, std::function, std::hash, ou d'un autre appel à std::not1 ont ce type définies, de même que les objets issus de la fonction std::unary_function obsolète .
Original:
The unary predicate type must define a member type, argument_type, that is convertible to the predicate's parameter type. The unary function objects obtained from std::ref, std::cref, std::negate, std::logical_not, std::mem_fn, std::function, std::hash, or from another call to std::not1 have this type defined, as are function objects derived from the deprecated std::unary_function.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Sommaire

[modifier]Paramètres

pred -
prédicat unaire
Original:
unary predicate
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier]Retourne la valeur

std::not1 retourne un objet de std::unary_negate<Predicate> type, construits avec pred .
Original:
std::not1 returns an object of type std::unary_negate<Predicate>, constructed with pred.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier]Exceptions

Aucun .
Original:
None.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifier]Exemple

#include <algorithm>#include <functional>#include <iostream>#include <vector>   struct LessThan7 :std::unary_function<int, bool>{bool operator()(int i)const{return i <7;}};   int main(){std::vector<int> v;for(int i =0; i <10;++i){ v.push_back(i);}   std::cout<<std::count_if(v.begin(), v.end(), std::not1(LessThan7()))<<"\n";   //same as above, but use a lambda functionstd::function<int(int)> less_than_9 =[](int x){return x <9;};std::cout<<std::count_if(v.begin(), v.end(), std::not1(less_than_9))<<"\n";}

Résultat :

3

[modifier]Voir aussi

foncteur retournant le complémentaire d'un foncteur existant, de type prédicat unaire
(classe générique)[edit]
(C++11)
adaptateur générique de foncteur
(classe générique)[edit]
fonction permettant de construire un objet de type std::binary_negate
(fonction générique)[edit]
(obsolète)
crée un foncteur à partir d'une fonction
(fonction générique)[edit]
(obsolète)
classe de base pour définir des foncteurs à 1 paramètre
(classe générique)[edit]
close