次の方法で共有


not1 (STL/CLR)

ファンクタの unary_negate を生成します。

template<typename Fun>
    unary_negate<Fun> not1(Fun% functor);

テンプレート名

  • 楽しみ
    ファンクタの種類。

関数パラメーター

  • ファンクタ
    ラップするファンクタ。

解説

テンプレート関数は unary_negate (STL/CLR)<Fun>(functor)を返します。論理 NOT 渡すファンクタの 1 引数のファンクタをラップする便利な手段として使用します。

使用例

// cliext_not1.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); 
    } 
 
  

必要条件

ヘッダー: <cliext と機能>

名前空間: の cliext

参照

関連項目

unary_negate (STL/CLR)