
102 Chapter Four—Evolutionary Computation Implementations
two_point_crossover,
uniform_crossover,
};
In Listing 4.3, fptr is the function pointer data type. To invoke the crossover routine
now is as simple as passing the case index to the array of function pointers to point
to the right function. One disadvantage of using this is that the order of the function
pointers is critical, and it has to be in exactly the same order as in the definition of
the enumeration data type. Otherwise, a different function will be called. Cautions
thus have to be taken when deleting and/or adding cases.
Allocating and Freeing Memory Space
Handling memory is always a challenge ...