Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide


Library:  General utilities


Local Index

No Entries


A function adaptor that creates a function object from a pointer to a function


#include <functional>

namespace std {
  template<class Arg, class Result>
  pointer_to_unary_function<Arg, Result>
  ptr_fun(Result (*f)(Arg));

  template<class Arg1, class Arg2, class Result>
  pointer_to_binary_function<Arg1, Arg2, Result>
  ptr_fun(Result (*x)(Arg1, Arg2));


The pointer_to_unary_function and pointer_to_binary_function classes encapsulate pointers to functions, and use operator() so that the resulting object serves as a function object for the function.

The ptr_fun() function is overloaded to create instances of pointer_to_unary_function or pointer_to_binary_function when included with the appropriate pointer to a function.


See Also

Function Objects, pointer_to_binary_function, pointer_to_unary_function, mem_fun

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 20.3.7

Previous fileTop of DocumentContentsIndex pageNext file