negate (STL/CLR)
Popisuje šablony třídy functor, při jeho argument Negované vrátí.Použití funkce objektu z hlediska jeho typ argumentu zadejte.
template<typename Arg>
ref class negate
{ // wrap operator()
public:
typedef Arg argument_type;
typedef bool result_type;
typedef Microsoft::VisualC::StlClr::UnaryDelegate<
argument_type, result_type>
delegate_type;
negate();
negate(negate<Arg>% right);
result_type operator()(argument_type left);
operator delegate_type^();
};
Parametry
- ARG
Typ argumentů.
Funkce členů
Definice typu |
Description |
---|---|
argument_type |
Typ argumentu functor. |
delegate_type |
Typ delegáta obecný. |
result_type |
Typ functor výsledek. |
Člen |
Description |
---|---|
negovat |
Konstrukce functor. |
Operátor |
Description |
---|---|
Operator() |
Vypočítá požadované funkce. |
delegate_type operátor ^ |
Vrhá functor delegátovi. |
Poznámky
Popisuje šablony třídy functor jeden argument.Definuje operátor členské operator() tak, že když je objekt volat jako funkci, vrátí hodnotu argumentu Negované.
Objekt můžete také předat jako argument funkce, jejichž typ je delegate_type^ a budou převedeny správně.
Příklad
// cliext_negate.cpp
// compile with: /clr
#include <cliext/algorithm>
#include <cliext/functional>
#include <cliext/vector>
typedef cliext::vector<int> Myvector;
int main()
{
Myvector c1;
c1.push_back(4);
c1.push_back(-3);
Myvector c3(2, 0);
// display initial contents " 4 -3"
for each (int elem in c1)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
// transform and display
cliext::transform(c1.begin(), c1.begin() + 2,
c3.begin(), cliext::negate<int>());
for each (int elem in c3)
System::Console::Write(" {0}", elem);
System::Console::WriteLine();
return (0);
}
Požadavky
Záhlaví: < cliext/funkční >
Obor názvů: cliext