feat: add eoEvalPrint
This commit is contained in:
parent
08b826c81b
commit
34eadef7a2
2 changed files with 24 additions and 0 deletions
|
|
@ -85,6 +85,7 @@
|
||||||
#include "eoEvalKeepBest.h"
|
#include "eoEvalKeepBest.h"
|
||||||
#include "eoEvalTimeThrowException.h"
|
#include "eoEvalTimeThrowException.h"
|
||||||
#include "eoEvalUserTimeThrowException.h"
|
#include "eoEvalUserTimeThrowException.h"
|
||||||
|
#include "eoEvalPrint.h"
|
||||||
|
|
||||||
// Continuators - all include eoContinue.h
|
// Continuators - all include eoContinue.h
|
||||||
#include "eoCombinedContinue.h"
|
#include "eoCombinedContinue.h"
|
||||||
|
|
|
||||||
23
eo/src/eoEvalPrint.h
Normal file
23
eo/src/eoEvalPrint.h
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
template< class EOT>
|
||||||
|
class eoEvalPrint: public eoEvalFunc<EOT>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
std::ostream& _out;
|
||||||
|
eoEvalFunc<EOT>& _eval;
|
||||||
|
std::string _sep;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
eoEvalPrint(eoEvalFunc<EOT>& eval, std::ostream& out=std::cout, std::string sep="\n") :
|
||||||
|
_out(out),
|
||||||
|
_eval(eval),
|
||||||
|
_sep(sep)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void operator()( EOT& sol )
|
||||||
|
{
|
||||||
|
_eval(sol);
|
||||||
|
_out << sol << _sep;
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue