[galib] The Genome Constructor and Member Functions
Alitis
alitis at gmail.com
Wed Aug 20 08:02:41 EDT 2008
Hello,
I am using GALib as part of a network simulation project on the
application layer of a simulated node. Due to the way the simulator I
am using is set up, the application layer must be a C++ class and
everything in the application layer must be a member of that class.
The problem I am experiencing is during construction of a genome. The
constructor requires an pointer to the Objective function of type *
(GAGenome&). Since the Objective function is now a member function of
the application layer class, its type changes to something which is
not recognized by the constructor. I can't simply make it a static
function, as it needs access to the application layer's data members
in order to compute a score. A number of FAQs have advised against
trying to cast a pointer to a member function into a standard function
pointer, since the size of the former is often greater than that of
the latter. As such I seem to be able to neither make the function
static, nor cast it into a form acceptable to the Genome constructor.
Any suggestions as to how I can get around this difficulty would be
greatly appreciated.
More information about the galib
mailing list