Public Member Functions | Private Attributes
ecl::BoundUnaryFreeFunction< A, R > Class Template Reference

Nullary function object for bound unary global/static functions. More...

#include <function_objects.hpp>

Inheritance diagram for ecl::BoundUnaryFreeFunction< A, R >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 BoundUnaryFreeFunction (R(*function)(A), A a)
 Binds a unary function and creates a nullary function object.
operator() ()
 This ensures any children objects are deleted correctly.
virtual ~BoundUnaryFreeFunction ()

Private Attributes

argument
R(* free_function )(A)

Detailed Description

template<typename A, typename R = void>
class ecl::BoundUnaryFreeFunction< A, R >

Nullary function object for bound unary global/static functions.

Binds the argument to a unary global/static function and uses this to construct a nullary function object.

Usage:

 void f(int i) {}

 int main() {
     BoundUnaryFreeFunction<int,void> function_object(f,1);
     function_object();
 }

Note, often the use of generateFunctionObject is simpler.

Template Parameters:
A: the type of the argument to be bound.
R: the return type.
See also:
ecl::utilities::BoundUnaryFreeFunction<A,void>, generateFunctionObject, FunctionObjects.

Definition at line 292 of file function_objects.hpp.


Constructor & Destructor Documentation

template<typename A, typename R = void>
ecl::BoundUnaryFreeFunction< A, R >::BoundUnaryFreeFunction ( R(*)(A)  function,
a 
) [inline]

Binds a unary function and creates a nullary function object.

Accepts both the function and a value for its single argument, binds them and creates a nullary function object.

Parameters:
function: the unary global/static function.
a: the argument to bind.

Definition at line 303 of file function_objects.hpp.

template<typename A, typename R = void>
virtual ecl::BoundUnaryFreeFunction< A, R >::~BoundUnaryFreeFunction ( ) [inline, virtual]

Definition at line 304 of file function_objects.hpp.


Member Function Documentation

template<typename A, typename R = void>
R ecl::BoundUnaryFreeFunction< A, R >::operator() ( ) [inline, virtual]

This ensures any children objects are deleted correctly.

A nullary function object call.

Redirects the function object call to the bound global/static function.

Returns:
R : the function's return value.

Implements ecl::NullaryFunction< R >.

Definition at line 312 of file function_objects.hpp.


Member Data Documentation

template<typename A, typename R = void>
A ecl::BoundUnaryFreeFunction< A, R >::argument [private]

Definition at line 316 of file function_objects.hpp.

template<typename A, typename R = void>
R(* ecl::BoundUnaryFreeFunction< A, R >::free_function)(A) [private]

Definition at line 315 of file function_objects.hpp.


The documentation for this class was generated from the following file:


ecl_utilities
Author(s): Daniel Stonier
autogenerated on Wed Aug 26 2015 11:27:20