Empirical
Public Types | Public Member Functions | List of all members
emp::memo_function< R(ARG)> Class Template Reference

#include <memo_function.h>

Public Types

using size_t = std::size_t
 
using return_t = R
 
using index_t = std::decay_t< ARG >
 
using fun_t = std::function< R(ARG)>
 
using this_t = memo_function< R(ARG)>
 

Public Member Functions

template<typename T >
 memo_function (T &&fun_info)
 
 memo_function (const this_t &)=default
 
 memo_function (this_t &&)=default
 
 memo_function ()
 
this_toperator= (const this_t &)=default
 Copy another memo_function of the same type. More...
 
this_toperator= (this_t &&)=default
 Move to here another memo function of the same type. More...
 
this_toperator= (const fun_t &_f)
 Set a new std::function of the appropriate type. More...
 
this_toperator= (fun_t &&_f)
 Move to here an std::function of the appropriate type. More...
 
template<typename T >
this_toperator= (T &&arg)
 A universal copy/move for other combinations that work with std::function. More...
 
size_t size () const
 How many values have been cached? More...
 
bool Has (const ARG &k) const
 Test if a certain input has been cached. More...
 
void Clear ()
 Clear out the cache. More...
 
void Erase (const ARG &k)
 Erase a specific entry from the cache. More...
 
template<class KEY >
return_t operator() (KEY &&k) const
 Call the memo_function. More...
 
 operator bool () const
 Identify if the memo_function has been set. More...
 
 operator std::function<R (ARG)>()
 Convert a memo_function to a regular std::function for function calls. More...
 
std::function< R(ARG)> to_function ()
 Convert a memo_function to a regular std::function for function calls. More...
 

Member Typedef Documentation

template<class R , class ARG >
using emp::memo_function< R(ARG)>::fun_t = std::function<R(ARG)>
template<class R , class ARG >
using emp::memo_function< R(ARG)>::index_t = std::decay_t<ARG>
template<class R , class ARG >
using emp::memo_function< R(ARG)>::return_t = R
template<class R , class ARG >
using emp::memo_function< R(ARG)>::size_t = std::size_t
template<class R , class ARG >
using emp::memo_function< R(ARG)>::this_t = memo_function<R(ARG)>

Constructor & Destructor Documentation

template<class R , class ARG >
template<typename T >
emp::memo_function< R(ARG)>::memo_function ( T &&  fun_info)
inline
template<class R , class ARG >
emp::memo_function< R(ARG)>::memo_function ( const this_t )
default
template<class R , class ARG >
emp::memo_function< R(ARG)>::memo_function ( this_t &&  )
default
template<class R , class ARG >
emp::memo_function< R(ARG)>::memo_function ( )
inline

Member Function Documentation

template<class R , class ARG >
void emp::memo_function< R(ARG)>::Clear ( )
inline

Clear out the cache.

template<class R , class ARG >
void emp::memo_function< R(ARG)>::Erase ( const ARG &  k)
inline

Erase a specific entry from the cache.

template<class R , class ARG >
bool emp::memo_function< R(ARG)>::Has ( const ARG &  k) const
inline

Test if a certain input has been cached.

template<class R , class ARG >
emp::memo_function< R(ARG)>::operator bool ( ) const
inline

Identify if the memo_function has been set.

template<class R , class ARG >
emp::memo_function< R(ARG)>::operator std::function<R ( ARG  )
inline

Convert a memo_function to a regular std::function for function calls.

template<class R , class ARG >
template<class KEY >
return_t emp::memo_function< R(ARG)>::operator() ( KEY &&  k) const
inline

Call the memo_function.

template<class R , class ARG >
this_t& emp::memo_function< R(ARG)>::operator= ( const this_t )
default

Copy another memo_function of the same type.

template<class R , class ARG >
this_t& emp::memo_function< R(ARG)>::operator= ( this_t &&  )
default

Move to here another memo function of the same type.

template<class R , class ARG >
this_t& emp::memo_function< R(ARG)>::operator= ( const fun_t _f)
inline

Set a new std::function of the appropriate type.

template<class R , class ARG >
this_t& emp::memo_function< R(ARG)>::operator= ( fun_t &&  _f)
inline

Move to here an std::function of the appropriate type.

template<class R , class ARG >
template<typename T >
this_t& emp::memo_function< R(ARG)>::operator= ( T &&  arg)
inline

A universal copy/move for other combinations that work with std::function.

template<class R , class ARG >
size_t emp::memo_function< R(ARG)>::size ( ) const
inline

How many values have been cached?

template<class R , class ARG >
std::function<R(ARG)> emp::memo_function< R(ARG)>::to_function ( )
inline

Convert a memo_function to a regular std::function for function calls.


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