Public Member Functions | Private Attributes | List of all members
ecl::BoundNullaryMemberFunction< C, R > Class Template Reference

Nullary function object for bound nullary member functions. More...

#include <function_objects.hpp>

Inheritance diagram for ecl::BoundNullaryMemberFunction< C, R >:
Inheritance graph
[legend]

Public Member Functions

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

Private Attributes

C & member_class
 
R(C::* member_function )()
 

Additional Inherited Members

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

Detailed Description

template<typename C, typename R = void>
class ecl::BoundNullaryMemberFunction< C, R >

Nullary function object for bound nullary member functions.

Binds the class instance for a nullary member function and uses this to construct a nullary function object.

Usage:

class A {
public:
void f() { //...
}
int main() {
A a;
BoundNullaryMemberFunction<A,void> function_object(&A::f,a);
function_object();
}
Template Parameters
C: the member function's class type.
R: the return type.
See also
ecl::utilities::BoundNullaryMemberFunction<C,void>, generateFunctionObject, FunctionObjects.

Definition at line 592 of file function_objects.hpp.

Constructor & Destructor Documentation

◆ BoundNullaryMemberFunction()

template<typename C , typename R = void>
ecl::BoundNullaryMemberFunction< C, R >::BoundNullaryMemberFunction ( R(C::*)()  function,
C &  class_object 
)
inline

Binds a unary member function and creates a nullary function object.

Accepts the function pointer and class instance, binds them and creates a nullary function object.

Parameters
function: the void member function.
class_object: the member function's class instance.

Definition at line 604 of file function_objects.hpp.

◆ ~BoundNullaryMemberFunction()

template<typename C , typename R = void>
virtual ecl::BoundNullaryMemberFunction< C, R >::~BoundNullaryMemberFunction ( )
inlinevirtual

Definition at line 608 of file function_objects.hpp.

Member Function Documentation

◆ operator()()

template<typename C , typename R = void>
R ecl::BoundNullaryMemberFunction< C, R >::operator() ( )
inlinevirtual

This ensures any children objects are deleted correctly.

A nullary function object call.

Redirects the nullary function object call to the bound member function.

Returns
R : the function's return value.

Implements ecl::NullaryFunction< void >.

Definition at line 617 of file function_objects.hpp.

Member Data Documentation

◆ member_class

template<typename C , typename R = void>
C& ecl::BoundNullaryMemberFunction< C, R >::member_class
private

Definition at line 620 of file function_objects.hpp.

◆ member_function

template<typename C , typename R = void>
R(C::* ecl::BoundNullaryMemberFunction< C, R >::member_function) ()
private

Definition at line 621 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