Well, what do you know, major commit.

Changed the signature of eoMon, eoBin and eoQuadOp to return a bool,
without invalidating fitness. Added a set of invalidators to take over
that job (see for instance eoSGA and eoSGATransform how this can transparantly used)

Derived eoState from eoFunctorStore (for convenience, from a design perspective this may sound wrong)

Added a wrap_op function that does the wrapping for you (see eoOpContainer how this made this functor
exceedingly less hairy). Checked all the tests removed the eoGeneric*Op family (not needed anymore)
and of course changed all the operators to reflect the change (and found a few that didn't
invalidate the fitness, thus really pointing out the advantage of the current approach)
This commit is contained in:
maartenkeijzer 2001-02-14 10:35:26 +00:00
commit 3a9b5a0e7e
30 changed files with 651 additions and 564 deletions

View file

@ -34,9 +34,9 @@ class eoFunctorBase;
/**
eoFunctorStore is a class that stores functors that are allocated on the
heap. This class can be used in factories to store allocated memory for
dynamically created functors.
dynamically created functors.
*/
class eoFunctorStore
class eoFunctorStore
{
public :
@ -45,13 +45,19 @@ class eoFunctorStore
~eoFunctorStore();
/// Add an eoFunctorBase to the store
void add(eoFunctorBase* r) { vec.push_back(r); }
template <class Functor>
Functor& storeFunctor(Functor* r)
{
// If the compiler complains about the following line, check if you really are giving it a pointer to an eoFunctorBase derived object
vec.push_back(r);
return *r;
}
private :
/// no copying allowed
eoFunctorStore(const eoFunctorStore&);
/// no copying allowed
eoFunctorStore operator=(const eoFunctorStore&);
std::vector<eoFunctorBase*> vec;