|
ALINK="#ff0000">
ptr_fun
Prototypetemplate <class Arg, class Result> pointer_to_unary_function<Arg, Result> ptr_fun(Result (*x)(Arg)); template <class Arg1, class Arg2, class Result> pointer_to_binary_function<Arg1, Arg2, Result> ptr_fun(Result (*x)(Arg1, Arg2)); DescriptionPtr_fun takes a function pointer as its argument and returns a function pointer adaptor, a type of function object. It is actually two different functions, not one (that is, the name ptr_fun is overloaded). If its argument is of type Result (*)(Arg) then ptr_fun creates a pointer_to_unary_function, and if its argument is of type Result (*)(Arg1, Arg2) then ptr_fun creates a pointer_to_binary_function.DefinitionDefined in the standard header functional, and in the nonstandard backward-compatibility header function.h.Requirements on typesThe argument must be a pointer to a function that takes either one or two arguments. The argument type(s) and the return type of the function are arbitrary, with the restriction that the function must return a value; it may not be a void function.PreconditionsComplexityExampleSee the examples in the discussions of pointer_to_unary_function and pointer_to_binary_function.NotesSee alsoFunction Objects, pointer_to_unary_function, pointer_to_binary_function, Adaptable Unary Function, Adaptable Binary FunctionCopyright © 1999 Silicon Graphics, Inc. All Rights Reserved. TrademarkInformation
|