From: Ullrich Koethe (u.koethe_at_[hidden])
Date: 2001-10-22 17:09:09
Hi Drew and Dave,
I'm working on Boost.Python again, and have found a similar problem. In
the constructor case, I've added code to my local version of
Boost.Python which allows an arbitrary factory function to be used as a
Python constructor by exporting it under the name "__init__". Standard
overload resolution applies, and both real constructors and factory
functions can be used for the same class. It works for the cases I need,
but I haven't tested it for all possible usages (especially in the
context of complicated Python inheritance hierarchies with multiple C++
I haven't looked into destructors, but something similar could probably
be done here. If you are interested, I can check the code into a branch.
PS: So far, I'm very pleased with Boost.Python. I have begun exporting
my VIGRA library, and I haven't had any major problems. One weak point,
however, is the implementation of customized 'to_python()/from_python()'
functions. For eample, I want to arrange for a float sequence of length
3 to be silently accpeted wherever an RGBValue object is expected. Have
you any ideas here?
-- ________________________________________________________________ | | | Ullrich Koethe Universität Hamburg / University of Hamburg | | FB Informatik / Dept. of Computer Science | | AB Kognitive Systeme / Cognitive Systems Group | | | | Phone: +49 (0)40 42883-2573 Vogt-Koelln-Str. 30 | | Fax: +49 (0)40 42883-2572 D - 22527 Hamburg | | Email: u.koethe_at_[hidden] Germany | | koethe_at_[hidden] | | WWW: http://kogs-www.informatik.uni-hamburg.de/~koethe/ | |________________________________________________________________|
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk