Skip to content. Skip to navigation

ICTP Portal

Sections
You are here: Home Manuals on-line PGI Compiler pgC_lib pointer_to_binary_function
Personal tools
Document Actions

pointer_to_binary_function



Click on the banner to return to the class reference home page.

pointer_to_binary_function


Function Object

Summary

A function object which adapts a pointer to a binary function to work where a binary_function is called for.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

None

Synopsis

#include <functional>

template <class Arg1, class Arg2, class Result>
class pointer_to_binary_function : public binary_function<Arg1, Arg2, 
                                                          Result> ;

Description

The pointer_to_binary_function class encapsulates a pointer to a two-argument function. The class provides an operator() so that the resulting object serves as a binary function object for that function.

The ptr_fun function is overloaded to create instances of a pointer_to_binary_function when provided with the appropriate pointer to a function.

Interface

template <class Arg1, class Arg2, class Result>
class pointer_to_binary_function : public binary_function<Arg1, Arg2, 
                                                          Result> {
 public:
   typedef typename binary_function<Arg1, Arg2, 
                                    Result>::second_argument_type 
                                             second_argument_type;
   typedef typename binary_function<Arg1, Arg2, 
                                    Result>::first_argument_type 
                                             first_argument_type;
   typedef typename binary_function<Arg1, Arg2, Result>::result_type 
                                                         result_type;   
   explicit pointer_to_binary_function (Result (*f)(Arg1, Arg2));
   Result operator() (const Arg1&, const Arg2&) const;
};

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

See Also

binary_function, Function Objects, pointer_to_unary_function, ptr_fun


©Copyright 1996, Rogue Wave Software, Inc.


Powered by Plone This site conforms to the following standards: