binary_negate (STL/CLR)
템플릿 클래스는 functor 설명, 호출할 때 논리를 반환 저장된 하는 두 인수 functor의 잘못.사용 하 여 function 개체의 해당 저장된 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^();
};
매개 변수
- 재미 있는
저장된 functor 유형을 지정 합니다.
멤버 함수
형식 정의 |
설명 |
---|---|
delegate_type |
제네릭 대리자의 형식입니다. |
first_argument_type |
Functor 첫 번째 인수의 유형을 지정 합니다. |
result_type |
Functor 결과 유형을 지정 합니다. |
second_argument_type |
두 번째 인수 functor 유형을 지정 합니다. |
stored_function_type |
Functor 유형을 지정 합니다. |
멤버 |
설명 |
---|---|
binary_negate |
Functor를 생성합니다. |
Operator |
설명 |
---|---|
operator) |
원하는 함수를 계산합니다. |
연산자 delegate_type^() |
대리자에는 functor를 비춥니다. |
설명
다른 두 인수 functor를 저장 하는 두 인수 functor 템플릿 클래스를 설명 합니다.멤버 연산자를 정의 합니다. operator() 함수로 해당 개체를 호출 하면 되도록, 논리 반환 저장된 functor를 않는 두 개의 인수와 함께 호출 합니다.
개체 형식이 함수 인수로 전달할 수도 있습니다 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);
}
요구 사항
헤더: < cliext/기능 >
네임 스페이스: cliext