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

Unary function object for member functions without arguments. More...

#include <function_objects.hpp>

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

Public Member Functions

 NullaryMemberFunction (R(C::*function)())
 Unary function object constructor for member functions without arguments. More...
 
operator() (C &class_object)
 This ensures any children objects are deleted correctly. More...
 
virtual ~NullaryMemberFunction ()
 
- Public Member Functions inherited from ecl::UnaryFunction< C &, void >
virtual ~UnaryFunction ()
 

Private Attributes

R(C::* member_function )()
 

Additional Inherited Members

- Public Types inherited from ecl::UnaryFunction< C &, void >
typedef C & argument_type
 The first argument type. More...
 
typedef void result_type
 The result type. More...
 

Detailed Description

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

Unary function object for member functions without arguments.

Creates a function object from a member function without arguments (note, the single argument to this unary function object is the class instance itself).

Usage:

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

Definition at line 397 of file function_objects.hpp.

Constructor & Destructor Documentation

◆ NullaryMemberFunction()

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

Unary function object constructor for member functions without arguments.

Accepts a void member function, and builds the function object around it.

Parameters
function: a void member function.

Definition at line 412 of file function_objects.hpp.

◆ ~NullaryMemberFunction()

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

Definition at line 413 of file function_objects.hpp.

Member Function Documentation

◆ operator()()

template<typename C , typename R = void>
R ecl::NullaryMemberFunction< C, R >::operator() ( C &  class_object)
inlinevirtual

This ensures any children objects are deleted correctly.

A unary function object call.

Uses the specified class instance to redirect the function call to the void member function.

Parameters
class_object: the member function's class instance.
Returns
R : the function's return value.

Implements ecl::UnaryFunction< C &, void >.

Definition at line 425 of file function_objects.hpp.

Member Data Documentation

◆ member_function

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

Definition at line 429 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 Sun Aug 2 2020 03:12:13