Compartilhar via


not2 (STL/CLR)

Generates a binary_negate for a functor.

template<typename Fun>
    binary_negate<Fun> not2(Fun% functor);

Template Parameters

  • Fun
    The type of the functor.

Function Parameters

  • functor
    The functor to wrap.

Remarks

The template function returns binary_negate (STL/CLR)<Fun>(functor). You use it as a convenient way to wrap a two-argument functor in a functor that delivers its logical NOT.

Example

// cliext_not2.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 c2; 
    c2.push_back(4); 
    c2.push_back(4); 
    Myvector c3(2, 0); 
 
// display initial contents " 4 3" and " 4 4" 
    for each (int elem in c1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
    for each (int elem in c2) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
// transform and display 
    cliext::less<int> less_op; 
 
    cliext::transform(c1.begin(), c1.begin() + 2, 
        c2.begin(), c3.begin(), 
        cliext::binary_negate<cliext::less<int> >(less_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, 
        c2.begin(), c3.begin(), cliext::not2(less_op)); 
    for each (int elem in c3) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
 4 3
 4 4
 1 0
 1 0

Requirements

Header: <cliext/functional>

Namespace: cliext

See Also

Reference

binary_negate (STL/CLR)