Public Member Functions | Private Attributes | List of all members
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]

Public Member Functions

 BoundUnaryFreeFunction (R(*function)(A), A a)
 Binds a unary function and creates a nullary function object. More...
 
operator() ()
 This ensures any children objects are deleted correctly. More...
 
virtual ~BoundUnaryFreeFunction ()
 
- Public Member Functions inherited from ecl::NullaryFunction< void >
virtual ~NullaryFunction ()
 

Private Attributes

argument
 
R(* free_function )(A)
 

Additional Inherited Members

- Public Types inherited from ecl::NullaryFunction< void >
typedef void result_type
 The result type. More...
 

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 298 of file function_objects.hpp.

Constructor & Destructor Documentation

◆ BoundUnaryFreeFunction()

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 311 of file function_objects.hpp.

◆ ~BoundUnaryFreeFunction()

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

Definition at line 312 of file function_objects.hpp.

Member Function Documentation

◆ operator()()

template<typename A , typename R = void>
R ecl::BoundUnaryFreeFunction< A, R >::operator() ( )
inlinevirtual

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< void >.

Definition at line 320 of file function_objects.hpp.

Member Data Documentation

◆ argument

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

Definition at line 324 of file function_objects.hpp.

◆ free_function

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

Definition at line 323 of file function_objects.hpp.


The documentation for this class was generated from the following file:
main
int main(int argc, char **argv)


ecl_utilities
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:32