typedefdoubleconst (Codon::*t_p_codon_fun)(Ribosome * const) const;
t_p_codon_fun Fun(); // returns a pointer to a codon function
// here is a list of codon functions that look like this:
doubleconst ABC(Ribosome * const) const; // hundreds of these
So now, somewhere else, I want to run the function that Codon::Fun() returns from a particular instance. How do I do this? I have an iterator to an instance of Codon:
auto pointer = &(*it_codon_sequence); // turn the iterator into a pointer (!?)
(pointer->*pointer->Fun())(this); // !?
This is the only way I have been able to get it to work. But does this make sense? Is there an easier/prettier way? I find this whole method-pointer business quite confusing...