Function< R, As > Class Template Reference

#include <Pt/Function.h>

Wraps free functions into a generic callable for use with the signals/slots. More...

Inherits Callable< R, As... >.

Public Types

typedef R(*) FuncT(As...)
 The function signature wrapped by this class.

Public Member Functions

 Function (FuncT function)
 Construct from function pointer.
R call (As... args) const
 Calls the callable entity and returns its result.
void invoke (As... args) const
 Invokes the invokable entity with the given arguments.
Function * clone () const
 Returns a copy of this instance.
bool operator== (const Function &other) const
 Returns true if both use the same function pointer.
R operator() (As... args) const
 Same as call().

(Note that these are not member symbols.)

ConstMethod< R, ClassT, As... > callable (ClassT &object, R(BaseT::*method)(As...) const)
 Returns a ConstMethod object for the given object/method pair.
Function< R, As... > callable (R(*function)(As...))
 Returns a Function wrapper for the given free/static function.
Method< R, ClassT, As... > callable (ClassT &object, R(BaseT::*method)(As...))
 Returns a Method object for the given object/method pair.

Detailed Description

template<typename R, typename... As>
class Pt::Function< R, As >

The Function class wraps free functions in the form of a Callable, for use with the signals/slots framework.

Member Function Documentation

◆ call()

template<typename R, typename... As>
R call ( As... args) const
virtual

This is the primary non-virtual entry point used by Delegate and other callers that need the return value. All derived classes must implement this.

Implements Callable< R, As... >.

◆ invoke()

template<typename R, typename... As>
void invoke ( As... args) const
virtual

The passed arguments must match the template parameters.

Implements Callable< R, As... >.

◆ clone()

template<typename R, typename... As>
Function * clone ( ) const
virtual

A copy of the instance is created with new is returned. Ownership is transfered to the caller, who has to delete it.

Implements Callable< R, As... >.