Lumiera  0.pre.03
»edit your freedom«
FunctionResult< SIG > Struct Template Reference

#include "lib/wrapper.hpp"

Description

template<typename SIG>
struct lib::wrapper::FunctionResult< SIG >

Extension of ItemWrapper: a function remembering the result of the last invocation.

Initially, the "value" is bottom (undefined, NIL), until the function is invoked for the first time. After that, the result of the last invocation can be accessed by operator* ()

Note
deliberately non-copyable, since we capture a reference to this in order to write to the embedded ItemWrapper. (to alleviate, we'd have to re-link after copying/moving)

Definition at line 401 of file wrapper.hpp.

Public Types

using Res = typename _Fun< SIG >::Ret
 
using ResWrapper = ItemWrapper< Res >
 

Public Member Functions

 FunctionResult ()=default
 by default locked to invalid state
 
template<typename FUN >
 FunctionResult (FUN &&targetFunction)
 Create result-remembering functor by outfitting a copy of the given function with an adaptor to capture each produced result. More...
 

Public Attributes

ResWrapper lastResult_
 

Additional Inherited Members

- Protected Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Constructor & Destructor Documentation

◆ FunctionResult()

FunctionResult ( FUN &&  targetFunction)
inline

Create result-remembering functor by outfitting a copy of the given function with an adaptor to capture each produced result.

Warning
if function result is a value, it is copied.

Definition at line 421 of file wrapper.hpp.

+ Inheritance diagram for FunctionResult< SIG >:
+ Collaboration diagram for FunctionResult< SIG >:

The documentation for this struct was generated from the following file: