다음을 통해 공유


pointer_to_binary_function 클래스

적응 가능한 이항 함수는 이항 함수 포인터로 변환합니다.

template<class Arg1, class Arg2, class Result>
   class pointer_to_binary_function 
   : public binary_function <Arg1, Arg2, Result> 
   {
   public:
   explicit pointer_to_binary_function(
      Result (*_pfunc )( Arg1, Arg2 ) 
   );
   Result operator()(
      Arg1 _Left, 
      Arg2 _Right
   ) const;
   };

매개 변수

  • _pfunc
    The binary function to be converted.

  • _Left
    The left object that the *_pfunc is called on.

  • _Right
    The right object that the *_pfunc is called on.

반환 값

The template class stores a copy of _pfunc. It defines its member function operator() as returning (*_pfunc)(_Left, _Right).

설명

A binary function pointer is a function object and may be passed to any Standard Template Library algorithm that is expecting a binary function as a parameter, but it is not adaptable. To use it with an adaptor, such as binding a value to it or using it with a negator, it must be supplied with the nested types first_argument_type, second_argument_type, and result_type that make such an adaptation possible. The conversion by pointer_to_binary_function allows the function adaptors to work with binary function pointers.

예제

The constructor of pointer_to_binary_function is rarely used directly. See the helper function ptr_fun for an example of how to declare and use the pointer_to_binary_function adaptor predicate.

요구 사항

헤더: <기능>

네임스페이스: std

참고 항목

참조

표준 템플릿 라이브러리