Empirical
|
#include <FunctionSet.h>
Public Types | |
using | base_t = emp::vector< std::function< RETURN_T(ARGS...)>> |
using | value_type = typename base_t::value_type |
using | return_t = RETURN_T |
using | iterator = iterator_wrapper< typename stdv_t::iterator > |
using | const_iterator = iterator_wrapper< typename stdv_t::const_iterator > |
using | reverse_iterator = iterator_wrapper< typename stdv_t::reverse_iterator > |
using | const_reverse_iterator = iterator_wrapper< typename stdv_t::const_reverse_iterator > |
using | size_type = typename stdv_t::size_type |
using | reference = typename stdv_t::reference |
using | const_reference = typename stdv_t::const_reference |
Public Member Functions | |
FunctionSet () | |
~FunctionSet () | |
size_t | GetSize () const |
How many functions are in this FunctionSet? More... | |
void | Add (const value_type &in_fun) |
Add a new funtion to this FunctionSet. More... | |
void | Remove (size_t pos) |
Remove the function at a specified position. More... | |
const emp::vector< RETURN_T > & | Run (ARGS...args) const |
Run all functions and return a vector of all results. More... | |
RETURN_T | Run (ARGS...args, std::function< RETURN_T(RETURN_T, RETURN_T)> comp_fun, RETURN_T default_val=0) const |
RETURN_T | FindMax (ARGS...args, RETURN_T default_val=0) const |
Run all functions and return the highest value. More... | |
RETURN_T | FindMin (ARGS...args, RETURN_T default_val=0) const |
Run all functions and return the lowest value. More... | |
RETURN_T | FindSum (ARGS...args, RETURN_T default_val=0) const |
Run all functions and return the total value. More... | |
RETURN_T | FindProduct (ARGS...args, RETURN_T default_val=1) const |
Run all functions and return a product of all values. More... | |
size_t | size () const |
iterator | begin () noexcept |
const_iterator | begin () const noexcept |
iterator | end () noexcept |
const_iterator | end () const noexcept |
void | resize (size_t new_size) |
void | resize (size_t new_size, const std::function< RETURN_T(ARGS...)> &val) |
std::function< RETURN_T(ARGS...)> & | operator[] (size_t pos) |
const std::function< RETURN_T(ARGS...)> & | operator[] (size_t pos) const |
std::function< RETURN_T(ARGS...)> & | back () |
const std::function< RETURN_T(ARGS...)> & | back () const |
std::function< RETURN_T(ARGS...)> & | front () |
const std::function< RETURN_T(ARGS...)> & | front () const |
void | push_back (PB_Ts &&...args) |
void | pop_back () |
iterator | insert (ARGS &&...args) |
iterator | erase (ARGS &&...args) |
iterator | emplace (ARGS &&...args) |
void | emplace_back (ARGS &&...args) |
Public Attributes | |
int | revision |
Setup a revision number - iterators must match the revision of their vector. More... | |
Protected Attributes | |
emp::vector< RETURN_T > | return_vals |
A vector of functions that can all be triggered at onece; results can either be returned in a vector or post-processed in a function (such as max, min, etc.) Derived from emp::vector, hence with all of the same methods as vector.
using emp::FunctionSet< RETURN_T(ARGS...)>::base_t = emp::vector<std::function<RETURN_T(ARGS...)>> |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
using emp::FunctionSet< RETURN_T(ARGS...)>::return_t = RETURN_T |
|
inherited |
|
inherited |
using emp::FunctionSet< RETURN_T(ARGS...)>::value_type = typename base_t::value_type |
|
inline |
|
inline |
|
inline |
Add a new funtion to this FunctionSet.
|
inlineinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
inlineinherited |
|
inline |
Run all functions and return the highest value.
|
inline |
Run all functions and return the lowest value.
|
inline |
Run all functions and return a product of all values.
|
inline |
Run all functions and return the total value.
|
inlineinherited |
|
inlineinherited |
|
inline |
How many functions are in this FunctionSet?
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inline |
Remove the function at a specified position.
|
inlineinherited |
|
inlineinherited |
|
inline |
Run all functions and return a vector of all results.
|
inline |
If you want to provide a filter function, you can retrieve a specific return value. The filter should take in two return values and indicate which is "better".
|
inlineinherited |
|
mutableprotected |
|
inherited |
Setup a revision number - iterators must match the revision of their vector.