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