less_equal (STL/CLR)
템플릿 클래스는 functor 설명 첫 번째 인수가 두 번째 보다 작거나 같은 경우에 호출 되 면 true를 반환 한다는.사용 하 여 해당 인수 형식에는 function 개체를 지정 합니다.
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 |
Functor 첫 번째 인수의 유형을 지정 합니다. |
result_type |
Functor 결과 유형을 지정 합니다. |
second_argument_type |
두 번째 인수 functor 유형을 지정 합니다. |
멤버 |
설명 |
---|---|
less_equal |
Functor를 생성합니다. |
Operator |
설명 |
---|---|
operator) |
원하는 함수를 계산합니다. |
연산자 delegate_type ^ |
대리자에는 functor를 비춥니다. |
설명
두 인수 functor 템플릿 클래스를 설명합니다.멤버 연산자를 정의 합니다. operator() 함수로 해당 개체를 호출 하면 되도록만 첫 번째 인수가 두 번째 보다 작거나입니다 경우 true를 반환 합니다.
개체 형식이 함수 인수로 전달할 수도 있습니다 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);
}
요구 사항
헤더: < cliext/기능 >
네임 스페이스: cliext