On 11/7/07, Malcolm Ryan <[EMAIL PROTECTED]> wrote: > Wouldn't it be a good idea to add an abstract copy() function to Space > () then, enforcing this requirement, rather than just assuming the > copy constructor will be there? This is what you do on GecodeVar > after all.
I don't know of a way to require statically that a constructor with a certain signature should be available in a class. However, if the copy function is called and there is no constructor with the right signature, an exception will be thrown alerting you to the fact. An abstract function in Space would only be enforced in direct inheritance from Space. If you had your own MySpace, and then made a class MySpecialSpace inheriting from MySpace, there would be no error if that function was left out. On the C++-side of Gecode, each Space must implement both a virtual function copy, as well as a copy constructor. The virtual copy-function is used as a polymorphic trampoline for accessing the right copy-constructor. Since Gecode/J is geared mainly towards teaching, we have tried to simplify the set-up for a normal model as far as possible. Using Java reflection, we could dispense with this function and write a generic one in the Space-class. Cheers, Mikael -- Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/ _______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users
