feat: add eoEvalPrint

This commit is contained in:
Johann Dreo 2020-10-09 14:53:53 +02:00
commit 34eadef7a2
2 changed files with 24 additions and 0 deletions

View file

@ -85,6 +85,7 @@
#include "eoEvalKeepBest.h"
#include "eoEvalTimeThrowException.h"
#include "eoEvalUserTimeThrowException.h"
#include "eoEvalPrint.h"
// Continuators - all include eoContinue.h
#include "eoCombinedContinue.h"

23
eo/src/eoEvalPrint.h Normal file
View 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;
}
};