Lambda< L, R, A > Class Template Referenceabstract

#include <Pt/Lambda.h>

Adapts a lambda or function object as a callable. More...

Inherits Callable< R, A... >.

Public Member Functions

template<typename T >
 Lambda (T &&lambda)
 Constructs from a lambda or function object.
 
operator() (A... args) const
 Call the callable entity. More...
 
virtual Callableclone () const=0
 Returns a copy of this instance. More...
 
call (A...) const
 Same as operator().
 
void invoke (A...) const
 Invoke the callable entity. More...
 

Related Functions

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

Detailed Description

template<typename L, typename R, typename... A>
class Pt::Lambda< L, R, A >

The callable is stored by value and must therefore be copyable. For a non-generic lambda, the factory derives the Callable interface from operator(). Generic lambdas require an explicitly supplied signature.

Member Function Documentation

◆ operator()()

R operator() ( A...  ) const
virtual

Since this class template is partially specialized, the passed arguments ARGUMENTS must match the template parameters.

Implements Callable< R, A... >.

◆ clone()

virtual Callable* clone
pure virtualinherited

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

◆ invoke()

void invoke ( A...  ) const
virtualinherited

Inherited from Invokable. Ignores the return value of the Callable. Since this class template is partially specialized, the passed arguments ARGUMENTS must match the template parameters.

Implements Invokable< A... >.