[C++-sig] Protected destructor compile error
David Abrahams
dave at boost-consulting.com
Thu Jun 22 14:27:33 CEST 2006
"Allen Bierbaum" <abierbaum at gmail.com> writes:
> It looks like there is a problem with the "const Viewport& port"
> argument being passed. For some reason the generated code seems to
> want to be able to destroy instances of the Viewport class. This
> class has protected constructor and destructor as it is reference
> counted and the user can only create them using a helper function
> (Camera::create()).
>
> Can anyone describe what is happening here
Boost.Python assumes that a const reference argument means that the
function can accept "rvalues", e.g. objects implicitly converted from
other python types. The generated converter thus has storage for a
temporary Viewport object which potentially needs to be destroyed
after the wrapped function is called.
> and what prerequisites
> exist for this call to work? Is there some call policy that I should
> be using to make this work?
Nope, but a thin wrapper that exposes Viewport& instead of Viewport
const& will help you.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list