Sdílet prostřednictvím


unary_negate (STL/CLR)

Popisuje šablony třídy functor, vrátí logické při volání, o jeho uložené functor jeden argument.Použití funkce objektu z hlediska jeho uložené functor určit.

template<typename Fun>
    ref class unary_negate
    { // wrap operator()
public:
    typedef Fun stored_function_type;
    typedef typename Fun::argument_type argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::UnaryDelegate<
        argument_type, result_type>
        delegate_type;

    unary_negate(Fun% functor);
    unary_negate(unary_negate<Fun>% right);

    result_type operator()(argument_type left);
    operator delegate_type^();
    };

Parametry

  • Zábava
    Typ uložených functor.

Funkce členů

Definice typu

Description

argument_type

Typ argumentu functor.

delegate_type

Typ delegáta obecný.

result_type

Typ functor výsledek.

Člen

Description

unary_negate

Konstrukce functor.

Operátor

Description

Operator()

Vypočítá požadované funkce.

delegate_type ^

Vrhá functor delegátovi.

Poznámky

Popisuje šablony třídy functor jeden argument, uchovávající jiného functor jeden argument.Definuje operátor členské operator() tak, že když je objekt volat jako funkci, vrátí logické nejsou uložené functor nazývá v argumentu.

Objekt můžete také předat jako argument funkce, jejichž typ je delegate_type^ a budou převedeny správně.

Příklad

// cliext_unary_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(0); 
    Myvector c3(2, 0); 
 
// display initial contents " 4 0" 
    for each (int elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
// transform and display 
    cliext::logical_not<int> not_op; 
 
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(), 
        cliext::unary_negate<cliext::logical_not<int> >(not_op)); 
    for each (int elem in c3) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
// transform and display with function 
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(), 
        cliext::not1(not_op)); 
    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

Viz také

Referenční dokumentace

not1 (STL/CLR)