binder1st (STL/CLR)

템플릿 클래스의 단일 인수 functor 설명, 호출할 때 저장 된 첫 번째 인수 및 제공 된 두 번째 인수에는 저장 된 두 인수 functor를 반환 합니다.사용 하 여 function 개체의 해당 저장된 functor 지정 합니다.

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

    binder1st(Fun% functor, first_argument_type left);
    binder1st(binder1st<Arg>% right);

    result_type operator()(second_argument_type right);
    operator delegate_type^();
    };

매개 변수

  • 재미 있는
    저장된 functor 유형을 지정 합니다.

멤버 함수

형식 정의

설명

delegate_type

제네릭 대리자의 형식입니다.

first_argument_type

Functor 첫 번째 인수의 유형을 지정 합니다.

result_type

Functor 결과 유형을 지정 합니다.

second_argument_type

두 번째 인수 functor 유형을 지정 합니다.

stored_function_type

Functor 유형을 지정 합니다.

멤버

설명

binder1st

Functor를 생성합니다.

Operator

설명

operator)

원하는 함수를 계산합니다.

연산자 delegate_type^()

대리자에는 functor를 비춥니다.

설명

두 인수 functor를 첫 번째 인수를 저장 하는 단일 인수 functor 템플릿 클래스를 설명 합니다.멤버 연산자를 정의 합니다. operator() 함수로 서 해당 개체를 호출 하면 않도록, 저장 된 첫 번째 인수 및 제공 된 두 번째 인수는 저장된 functor 호출 결과 반환 합니다.

개체 형식이 함수 인수로 전달할 수도 있습니다 delegate_type^ 및 적절 하 게 변환 됩니다.

예제

// cliext_binder1st.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

참고 항목

참조

bind1st (STL/CLR)