functional (STL/CLR)

함수 클래스 템플릿 및 관련 템플릿 대리자 및 함수를 정의하려면 STL/CLR 헤더 <cliext/functional> 를 포함합니다.

구문

#include <functional>

요구 사항

헤더:<cliext/functional>

네임스페이스:cliext

선언

대리인 설명
binary_delegate (STL/CLR) 두 인수 대리자입니다.
binary_delegate_noreturn (STL/CLR) 2 인수 대리자를 반환합니다 void.
unary_delegate (STL/CLR) 1 인수 대리자입니다.
unary_delegate_noreturn (STL/CLR) 1 인수 대리자를 반환합니다 void.
클래스 설명
binary_negate (STL/CLR) 2 인수 펀터를 부정하는 펀터입니다.
binder1st (STL/CLR) 첫 번째 인수를 두 인수 functor에 바인딩하는 Functor입니다.
binder2nd (STL/CLR) 두 번째 인수를 두 인수 functor에 바인딩하는 Functor입니다.
divides (STL/CLR) Functor를 나눕니다.
equal_to (STL/CLR) 같음 비교 펀터입니다.
greater (STL/CLR) 더 큰 비교 펀터.
greater_equal (STL/CLR) 크거나 같은 비교 펀터입니다.
less (STL/CLR) 적은 비교 균사.
less_equal (STL/CLR) 보다 작거나 같은 비교 펀터입니다.
logical_and (STL/CLR) 논리 및 펀터입니다.
logical_not (STL/CLR) 논리 NOT functor입니다.
logical_or (STL/CLR) 논리 또는 펀터입니다.
minus (STL/CLR) 펑터를 뺍니다.
modulus (STL/CLR) 모듈러스 펀터.
multiplies (STL/CLR) Functor를 곱합니다.
negate (STL/CLR) 인수를 부정 반환하는 Functor입니다.
not_equal_to (STL/CLR) 비교 균등하지 않습니다.
plus (STL/CLR) functor를 추가합니다.
unary_negate (STL/CLR) 원 인수 펀터를 부정하는 펀터입니다.
함수 설명
bind1st (STL/CLR) 인수 및 functor에 대한 binder1st를 생성합니다.
bind2nd (STL/CLR) 인수 및 functor에 대한 binder2nd를 생성합니다.
not1 (STL/CLR) functor에 대한 unary_negate 생성합니다.
not2 (STL/CLR) functor에 대한 binary_negate 생성합니다.

멤버

binary_delegate (STL/CLR)

제네릭 클래스는 두 인수 대리자를 설명합니다. 인수 및 반환 형식 측면에서 대리자를 지정하는 데 사용합니다.

구문

generic<typename Arg1,
    typename Arg2,
    typename Result>
    delegate Result binary_delegate(Arg1, Arg2);

매개 변수

Arg1
첫 번째 인수의 형식입니다.

Arg2
두 번째 인수의 형식입니다.

Result
반환 형식입니다.

설명

제네릭 대리자는 두 인수 함수를 설명합니다.

다음 함수 템플릿에서 다음을 수행합니다.

binary_delegate<int, int, int> Fun1;

binary_delegate<int, int, int> Fun2;

형식 Fun1Fun2 동의어는 다음과 같습니다.

delegate int Fun1(int, int);

delegate int Fun2(int, int);

형식이 다릅니다.

예시

// cliext_binary_delegate.cpp
// compile with: /clr
#include <cliext/functional>

bool key_compare(wchar_t left, wchar_t right)
    {
    return (left < right);
    }

typedef cliext::binary_delegate<wchar_t, wchar_t, bool> Mydelegate;
int main()
    {
    Mydelegate^ kcomp = gcnew Mydelegate(&key_compare);

    System::Console::WriteLine("compare(L'a', L'a') = {0}",
        kcomp(L'a', L'a'));
    System::Console::WriteLine("compare(L'a', L'b') = {0}",
        kcomp(L'a', L'b'));
    System::Console::WriteLine("compare(L'b', L'a') = {0}",
        kcomp(L'b', L'a'));
    System::Console::WriteLine();
    return (0);
    }
compare(L'a', L'a') = False
compare(L'a', L'b') = True
compare(L'b', L'a') = False

binary_delegate_noreturn (STL/CLR)

제네릭 클래스는 반환하는 두 인수 대리자를 설명합니다 void. 인수 측면에서 대리자를 지정하는 데 사용합니다.

구문

generic<typename Arg1,
    typename Arg2>
    delegate void binary_delegate(Arg1, Arg2);

매개 변수

Arg1
첫 번째 인수의 형식입니다.

Arg2
두 번째 인수의 형식입니다.

설명

제네릭 대리자는 반환되는 두 인수 함수를 설명합니다 void.

다음 함수 템플릿에서 다음을 수행합니다.

binary_delegate_noreturn<int, int> Fun1;

binary_delegate_noreturn<int, int> Fun2;

형식 Fun1Fun2 동의어는 다음과 같습니다.

delegate void Fun1(int, int);

delegate void Fun2(int, int);

형식이 다릅니다.

예시

// cliext_binary_delegate_noreturn.cpp
// compile with: /clr
#include <cliext/functional>

void key_compare(wchar_t left, wchar_t right)
    {
    System::Console::WriteLine("compare({0}, {1}) = {2}",
        left, right, left < right);
    }

typedef cliext::binary_delegate_noreturn<wchar_t, wchar_t> Mydelegate;
int main()
    {
    Mydelegate^ kcomp = gcnew Mydelegate(&key_compare);

    kcomp(L'a', L'a');
    kcomp(L'a', L'b');
    kcomp(L'b', L'a');
    System::Console::WriteLine();
    return (0);
    }
compare(a, a) = False
compare(a, b) = True
compare(b, a) = False

binary_negate (STL/CLR)

템플릿 클래스는 호출될 때 저장된 두 인수 펀터의 논리 NOT을 반환하는 functor를 설명합니다. 이 함수는 저장된 functor의 측면에서 함수 개체를 지정합니다.

구문

template<typename Fun>
    ref class binary_negate
    { // 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 bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    explicit binary_negate(Fun% functor);
    binary_negate(binary_negate<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Fun
저장된 functor의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
stored_function_type functor의 형식입니다.
멤버 설명
binary_negate functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^() functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 다른 두 인수 functor를 저장하는 2 인수 펀터에 대해 설명합니다. 개체가 함수로 호출될 때 두 인수로 호출된 저장된 functor의 논리 NOT을 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_binary_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(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

bind1st (STL/CLR)

인수 및 functor에 대한 a를 생성합니다 binder1st .

구문

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

템플릿 매개 변수

Arg
인수 형식입니다.

Fun
functor의 형식입니다.

함수 매개 변수

functor
래핑할 펀터입니다.

left
래핑할 첫 번째 인수입니다.

설명

함수 템플릿은 .를 반환합니다 binder1st<Fun>(functor, left). 두 번째 인수로 호출하는 1 인수 펀터에서 2 인수 functor와 첫 번째 인수를 래핑하는 편리한 방법으로 사용합니다.

예시

// 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);
    }
4 3
-1 0
-1 0

bind2nd (STL/CLR)

인수 및 functor에 대한 a를 생성합니다 binder2nd .

구문

template<typename Fun,
    typename Arg>
    binder2nd<Fun> bind2nd(Fun% functor,
        Arg right);

템플릿 매개 변수

Arg
인수 형식입니다.

Fun
functor의 형식입니다.

함수 매개 변수

functor
래핑할 펀터입니다.

right
래핑할 두 번째 인수입니다.

설명

함수 템플릿은 .를 반환합니다 binder2nd<Fun>(functor, right). 첫 번째 인수로 호출하는 1 인수 펀터에서 두 인수 펀터와 두 번째 인수를 래핑하는 편리한 방법으로 사용합니다.

예시

// cliext_bind2nd.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::binder2nd<cliext::minus<int> > sub4(sub_op, 4);

    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        sub4);
    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(),
        bind2nd(sub_op, 4));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
0 -1
0 -1

binder1st (STL/CLR)

템플릿 클래스는 호출될 때 저장된 첫 번째 인수와 제공된 두 번째 인수를 사용하여 호출된 저장된 두 인수 functor를 반환하는 1 인수 functor를 설명합니다. 이 함수는 저장된 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^();
    };

매개 변수

Fun
저장된 functor의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
stored_function_type functor의 형식입니다.
멤버 설명
binder1st functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^() functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 2 인수 functor와 첫 번째 인수를 저장하는 1 인수 functor를 설명합니다. 개체가 함수로 호출될 때 저장된 첫 번째 인수와 제공된 두 번째 인수를 사용하여 저장된 functor를 호출한 결과를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

개체를 형식 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);
    }
4 3
-1 0
-1 0

binder2nd (STL/CLR)

템플릿 클래스는 호출될 때 제공된 첫 번째 인수와 저장된 두 번째 인수를 사용하여 호출된 저장된 두 인수 functor를 반환하는 1 인수 functor를 설명합니다. 이 함수는 저장된 functor의 측면에서 함수 개체를 지정합니다.

구문

template<typename Fun>
    ref class binder2nd
    { // 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<
        first_argument_type, result_type>
        delegate_type;

    binder2nd(Fun% functor, second_argument_type left);
    binder2nd(binder2nd<Arg>% right);

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

매개 변수

Fun
저장된 functor의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
stored_function_type functor의 형식입니다.
멤버 설명
binder2nd functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^() functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 2 인수 functor와 두 번째 인수를 저장하는 1 인수 펀터에 대해 설명합니다. 개체가 함수로 호출될 때 제공된 첫 번째 인수와 저장된 두 번째 인수를 사용하여 저장된 functor를 호출한 결과를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_binder2nd.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::binder2nd<cliext::minus<int> > sub4(sub_op, 4);

    cliext::transform(c1.begin(), c1.begin() + 2, c3.begin(),
        sub4);
    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(),
        bind2nd(sub_op, 4));
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
0 -1
0 -1

divides (STL/CLR)

템플릿 클래스는 호출할 때 첫 번째 인수를 두 번째로 나눈 값을 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class divides
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    divides();
    divides(divides<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수 및 반환 값의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
divides functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^() functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체가 함수로 호출되면 첫 번째 인수를 두 번째로 나눈 값을 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_divides.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(2);
    c2.push_back(1);
    Myvector c3(2, 0);

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

equal_to (STL/CLR)

템플릿 클래스는 첫 번째 인수가 두 번째 인수와 같은 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class equal_to
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    equal_to();
    equal_to(equal_to<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
equal_to functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^() functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체가 함수로 호출되면 첫 번째 인수가 두 번째 인수와 같은 경우에만 true를 반환하도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_equal_to.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::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::equal_to<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
1 0

greater (STL/CLR)

템플릿 클래스는 첫 번째 인수가 두 번째 인수보다 큰 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class greater
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    greater();
    greater(greater<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
greater functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체가 함수로 호출되면 첫 번째 인수가 두 번째 인수보다 큰 경우에만 true를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_greater.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(3);
    c2.push_back(3);
    Myvector c3(2, 0);

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

greater_equal (STL/CLR)

템플릿 클래스는 첫 번째 인수가 두 번째 인수보다 크거나 같은 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class greater_equal
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    greater_equal();
    greater_equal(greater_equal<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
greater_equal functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체를 함수로 호출할 때 첫 번째 인수가 두 번째 인수보다 크거나 같은 경우에만 true를 반환하도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_greater_equal.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::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::greater_equal<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
1 0

less (STL/CLR)

템플릿 클래스는 첫 번째 인수가 두 번째 인수보다 작은 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class less
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    less();
    less(less<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
less functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체를 함수로 호출할 때 첫 번째 인수가 두 번째 인수보다 작은 경우에만 true를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_less.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::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::less<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
0 1

less_equal (STL/CLR)

템플릿 클래스는 첫 번째 인수가 두 번째 인수보다 작거나 같은 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class less_equal
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    less_equal();
    less_equal(less_equal<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
less_equal functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체를 함수로 호출할 때 첫 번째 인수가 두 번째 인수보다 작거나 같은 경우에만 true를 반환하도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_less_equal.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(3);
    c2.push_back(3);
    Myvector c3(2, 0);

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

logical_and (STL/CLR)

템플릿 클래스는 호출 시 첫 번째 인수와 두 번째 테스트가 모두 true인 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class logical_and
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    logical_and();
    logical_and(logical_and<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
logical_and functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체가 함수로 호출되면 첫 번째 인수와 두 번째 테스트가 모두 true인 경우에만 true를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_logical_and.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(2);
    c1.push_back(0);
    Myvector c2;
    c2.push_back(3);
    c2.push_back(0);
    Myvector c3(2, 0);

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

logical_not (STL/CLR)

템플릿 클래스는 호출할 때 인수가 false로 테스트되는 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

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

    logical_not();
    logical_not(logical_not<Arg> %right);

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

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
argument_type functor 인수의 형식입니다.
delegate_type 제네릭 대리자의 형식입니다.
result_type 펀터 결과의 형식입니다.
멤버 설명
logical_not functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 한 인수 functor에 대해 설명합니다. 개체가 함수로 호출되면 인수가 false로 테스트되는 경우에만 true를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_logical_not.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::transform(c1.begin(), c1.begin() + 2,
        c3.begin(), cliext::logical_not<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 0
0 1

logical_or (STL/CLR)

템플릿 클래스는 호출 시 첫 번째 인수 또는 두 번째 테스트가 true인 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class logical_or
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    logical_or();
    logical_or(logical_or<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
logical_or functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체가 함수로 호출되면 첫 번째 인수 또는 두 번째 테스트가 true인 경우에만 true를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_logical_or.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(2);
    c1.push_back(0);
    Myvector c2;
    c2.push_back(0);
    c2.push_back(0);
    Myvector c3(2, 0);

// display initial contents " 2 0" and " 0 0"
    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::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::logical_or<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
2 0
0 0
1 0

minus (STL/CLR)

템플릿 클래스는 호출 시 첫 번째 인수에서 두 번째 인수를 뺀 값을 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class minus
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    minus();
    minus(minus<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수 및 반환 값의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
minus functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체가 함수로 호출되면 첫 번째 인수에서 두 번째 인수를 뺀 값을 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_minus.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(2);
    c2.push_back(1);
    Myvector c3(2, 0);

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

modulus (STL/CLR)

템플릿 클래스는 호출할 때 첫 번째 인수 모듈로를 두 번째 인수로 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class modulus
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    modulus();
    modulus(modulus<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수 및 반환 값의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
modulus functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체를 함수로 호출할 때 첫 번째 인수 모듈로 두 번째 인수를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_modulus.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(2);
    Myvector c2;
    c2.push_back(3);
    c2.push_back(1);
    Myvector c3(2, 0);

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

multiplies (STL/CLR)

템플릿 클래스는 호출할 때 첫 번째 인수를 두 번째 인수 횟수로 반환하는 펀터에 대해 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class multiplies
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    multiplies();
    multiplies(multiplies<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수 및 반환 값의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
multiplies functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체를 함수로 호출할 때 첫 번째 인수를 두 번째 인수 횟수만큼 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_multiplies.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(2);
    c2.push_back(1);
    Myvector c3(2, 0);

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

negate (STL/CLR)

템플릿 클래스는 호출될 때 부정된 인수를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

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

    negate();
    negate(negate<Arg>% right);

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

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
argument_type functor 인수의 형식입니다.
delegate_type 제네릭 대리자의 형식입니다.
result_type 펀터 결과의 형식입니다.
멤버 설명
negate functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 한 인수 functor에 대해 설명합니다. 개체가 함수로 호출될 때 부정된 인수를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

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

not_equal_to (STL/CLR)

템플릿 클래스는 첫 번째 인수가 두 번째 인수와 같지 않은 경우에만 true를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class not_equal_to
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef bool result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    not_equal_to();
    not_equal_to(not_equal_to<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
not_equal_to functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체가 함수로 호출되면 첫 번째 인수가 두 번째 인수와 같지 않은 경우에만 true를 반환하도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_not_equal_to.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::transform(c1.begin(), c1.begin() + 2,
        c2.begin(), c3.begin(), cliext::not_equal_to<int>());
    for each (int elem in c3)
        System::Console::Write(" {0}", elem);
    System::Console::WriteLine();
    return (0);
    }
4 3
4 4
0 1

not1 (STL/CLR)

functor용을 unary_negate 생성합니다.

구문

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

템플릿 매개 변수

Fun
functor의 형식입니다.

함수 매개 변수

functor
래핑할 펀터입니다.

설명

함수 템플릿은 .를 반환합니다 unary_negate<Fun>(functor). 논리적 NOT을 제공하는 펀터에서 하나의 인수 펀터를 래핑하는 편리한 방법으로 사용합니다.

예시

// 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);
    }
4 0
1 0
1 0

not2 (STL/CLR)

functor용을 binary_negate 생성합니다.

구문

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

템플릿 매개 변수

Fun
functor의 형식입니다.

함수 매개 변수

functor
래핑할 펀터입니다.

설명

함수 템플릿은 .를 반환합니다 binary_negate<Fun>(functor). 논리적 NOT을 제공하는 펀터에 2 인수 펀터를 래핑하는 편리한 방법으로 사용합니다.

예시

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

plus (STL/CLR)

템플릿 클래스는 호출 시 첫 번째 인수와 두 번째 인수를 반환하는 functor를 설명합니다. 함수 개체를 인수 형식으로 지정하는 데 사용합니다.

구문

template<typename Arg>
    ref class plus
    { // wrap operator()
public:
    typedef Arg first_argument_type;
    typedef Arg second_argument_type;
    typedef Arg result_type;
    typedef Microsoft::VisualC::StlClr::BinaryDelegate<
        first_argument_type, second_argument_type, result_type>
        delegate_type;

    plus();
    plus(plus<Arg>% right);

    result_type operator()(first_argument_type left,
        second_argument_type right);
    operator delegate_type^();
    };

매개 변수

Arg
인수 및 반환 값의 형식입니다.

멤버 함수

형식 정의 설명
delegate_type 제네릭 대리자의 형식입니다.
first_argument_type 첫 번째 펀터 인수의 형식입니다.
result_type 펀터 결과의 형식입니다.
second_argument_type functor second 인수의 형식입니다.
멤버 설명
plus functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
operator delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 두 인수 functor를 설명합니다. 개체가 함수로 호출되면 첫 번째 인수와 두 번째 인수를 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예시

// cliext_plus.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(2);
    c2.push_back(1);
    Myvector c3(2, 0);

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

unary_delegate (STL/CLR)

제네릭 클래스는 한 인수 대리자를 설명합니다. 인수 및 반환 형식 측면에서 대리자를 지정하는 데 사용합니다.

구문

generic<typename Arg,
    typename Result>
    delegate Result unary_delegate(Arg);

매개 변수

Arg
인수 형식입니다.

Result
반환 형식입니다.

설명

제네릭 대리자는 한 인수 함수를 설명합니다.

다음 함수 템플릿에서 다음을 수행합니다.

unary_delegate<int, int> Fun1;

unary_delegate<int, int> Fun2;

형식 Fun1Fun2 동의어는 다음과 같습니다.

delegate int Fun1(int);

delegate int Fun2(int);

형식이 다릅니다.

예시

// cliext_unary_delegate.cpp
// compile with: /clr
#include <cliext/functional>

int hash_val(wchar_t val)
    {
    return ((val * 17 + 31) % 67);
    }

typedef cliext::unary_delegate<wchar_t, int> Mydelegate;
int main()
    {
    Mydelegate^ myhash = gcnew Mydelegate(&hash_val);

    System::Console::WriteLine("hash(L'a') = {0}", myhash(L'a'));
    System::Console::WriteLine("hash(L'b') = {0}", myhash(L'b'));
    return (0);
    }
hash(L'a') = 5
hash(L'b') = 22

unary_delegate_noreturn (STL/CLR)

제네릭 클래스는 반환하는 1 인수 대리자를 설명합니다 void. 인수 형식의 측면에서 대리자를 지정하는 데 사용합니다.

구문

generic<typename Arg>
    delegate void unary_delegate_noreturn(Arg);

매개 변수

Arg
인수 형식입니다.

설명

제네릭 대리자는 반환되는 한 인수 함수를 설명합니다 void.

다음 함수 템플릿에서 다음을 수행합니다.

unary_delegate_noreturn<int> Fun1;

unary_delegate_noreturn<int> Fun2;

형식 Fun1Fun2 동의어는 다음과 같습니다.

delegate void Fun1(int);

delegate void Fun2(int);

형식이 다릅니다.

예시

// cliext_unary_delegate_noreturn.cpp
// compile with: /clr
#include <cliext/functional>

void hash_val(wchar_t val)
    {
    System::Console::WriteLine("hash({0}) = {1}",
       val, (val * 17 + 31) % 67);
    }

typedef cliext::unary_delegate_noreturn<wchar_t> Mydelegate;
int main()
    {
    Mydelegate^ myhash = gcnew Mydelegate(&hash_val);

    myhash(L'a');
    myhash(L'b');
    return (0);
    }
hash(a) = 5
hash(b) = 22

unary_negate (STL/CLR)

템플릿 클래스는 호출될 때 저장된 1 인수 펀터의 논리 NOT을 반환하는 functor를 설명합니다. 이 함수는 저장된 functor의 측면에서 함수 개체를 지정합니다.

구문

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^();
    };

매개 변수

Fun
저장된 functor의 형식입니다.

멤버 함수

형식 정의 설명
argument_type functor 인수의 형식입니다.
delegate_type 제네릭 대리자의 형식입니다.
result_type 펀터 결과의 형식입니다.
멤버 설명
unary_negate functor를 생성합니다.
연산자 설명
operator() 원하는 함수를 계산합니다.
delegate_type^ functor를 대리자로 캐스팅합니다.

설명

템플릿 클래스는 다른 한 인수 functor를 저장하는 한 인수 functor를 설명합니다. 개체가 함수로 호출될 때 인수를 사용하여 호출된 저장된 functor의 논리 NOT을 반환할 수 있도록 멤버 연산 operator() 자를 정의합니다.

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

예제

// 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);
    }
4 0
1 0
1 0