次の方法で共有


bind1st (STL/CLR)

引数とファンクタの binder1st を生成します。

template<typename Fun,
    typename Arg>
    binder1st<Fun> bind1st(Fun% functor,
        Arg left);

テンプレート名

  • 引数
    引数の型。

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

関数パラメーター

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

  • [left]
    ラップする最初の引数。

解説

テンプレート関数は binder1st (STL/CLR)<Fun>(functor, left)を返します。2 番目の呼び出し引数でその 1 引数のファンクタの 2 引数のファンクタおよび初期引数をラップする便利な手段として使用します。

使用例

// cliext_bind1st.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::minus<int> sub_op; 
    cliext::binder1st<cliext::minus<int> > subfrom3(sub_op, 3); 
 
    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(), 
        subfrom3); 
    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(), 
        bind1st(sub_op, 3)); 
    for each (int elem in c3) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
    return (0); 
    } 
 
  

必要条件

ヘッダー: <cliext と機能>

名前空間: の cliext

参照

関連項目

binder1st (STL/CLR)