[C++-sig] Duplicate class and method definition
seefeld at sympatico.ca
Mon Feb 22 15:59:08 CET 2010
On 02/22/2010 09:45 AM, André Prins wrote:
> Hi All,
> Recently, I had some problems with a duplicate method and class
> definition begin accepted by boost::python (version 1.41 on MSVC).
> Consider the following c++-code, which declares a class Foo twice, but
> with different bindings for the same function.
> It is obvious that this is not the intended use of Boost-python, but I
> am wondering: why does it assert at runtime without the noncopyable
> and why does it "more or less work" with the boost::noncopyable. And
> is there a method to detect such multiple definitions of the same
For the first two questions: I would suggest you consider the code
"ill-formed" and the behavior "undefined", so there isn't any need to
(second-)guess what the library is doing, and why things appear to be
working in one case but not the other.
As to the last question: I suggest you submit a request for enhancement
for this. I'm pretty sure the library can detect this, and raise an
appropriate exception. Alternatively, if it is decided that the above is
a valuable use-case to support, the library needs to be improved to
I'm saying that because recently we had a discussion about per-module
converter registries, to avoid conflicts when working with multiple
extension modules that may provide equivalent converters, where it is
important to be able to pick explicitly which one is going to be used.
...ich hab' noch einen Koffer in Berlin...
More information about the Cplusplus-sig