functional_mem_fun_t
functional_mem_fun_t (멤버 함수 포인터 래퍼)
이 페이지는 C++ 표준 라이브러리의 mem_fun_t 및 관련 클래스 템플릿에 대해 설명해요. 이 클래스들은 멤버 함수 포인터를 래핑해서 일반 함수 객체처럼 호출할 수 있게 해주는 어댑터예요. C++11에서 더 이상 사용되지 않게 되었고, C++17에서 제거되었어요.
출처: cppreference
본문
정의
다음은 <functional> 헤더에 정의된 클래스 템플릿들이에요.
| Defined in header |
||
|---|---|---|
| template < class S , class T > class mem_fun_t : public unary_function < T * , S > { public : explicit mem_fun_t ( S ( T ::* p )()); S operator ()( T * p ) const ; }; | (1) | (deprecated in C++11) (removed in C++17) |
| template < class S , class T > class const_mem_fun_t : public unary_function < const T * , S > { public : explicit const_mem_fun_t ( S ( T ::* p )() const ); S operator ()( const T * p ) const ; }; | (2) | (deprecated in C++11) (removed in C++17) |
| template < class S , class T , class A > class mem_fun1_t : public binary_function < T * , A , S > { public : explicit mem_fun1_t ( S ( T ::* p )( A )); S operator ()( T * p , A x ) const ; }; | (3) | (deprecated in C++11) (removed in C++17) |
| template < class S , class T , class A > class const_mem_fun1_t : public binary_function < const T * , A , S > { public : explicit const_mem_fun1_t ( S ( T ::* p )( A ) const ); S operator ()( const T * p , A x ) const ; }; | (4) | (deprecated in C++11) (removed in C++17) |
설명
이 클래스들은 멤버 함수 포인터를 감싸는 래퍼예요. 호출할 멤버 함수를 가진 클래스 인스턴스는 operator()에 포인터로 전달돼요. 즉, 객체 포인터를 인자로 받아 해당 객체의 멤버 함수를 호출하는 방식이에요.
같이 보기
| mem_fun (deprecated in C++11) (removed in C++17) | creates a wrapper from a pointer to member function, callable with a pointer to object (function template) [edit] |
|---|---|
| mem_fun_ref_t mem_fun1_ref_t const_mem_fun_ref_t const_mem_fun1_ref_t (deprecated in C++11) (removed in C++17) | wrapper for a pointer to nullary or unary member function, callable with a reference to object (class template) [edit] |