[C++-sig] init from free function instead of constructor
Edson Tadeu
e.tadeu at gmail.com
Fri Feb 2 20:49:50 CET 2007
I'm also getting the same errors when trying to wrap a "free" constructor
returning by value for a class whose holder is itself.
Inside detail::install_holder<T>::dispatch(Ptr x, mpl::false_), it is trying
to access the type pointee<Ptr>::type, but Ptr is my own class and not a
smart pointer, so the compiler gets angry with pointee_impl<false>::apply<T>
trying to get T::element_type.
Is there any fix for this or any solution that do not involve an ugly hack
with heap allocation and converting back and forth between shared_ptr<>?
Thanks
John Reid wrote:
Ok so by-value should be handled by the default call policies if the
documentation is right.
I have checked with a minimal test case that I get the same errors:
class X { };
X make_x( const std::string & ) { return X(); }
void export_x()
{
using namespace boost::python;
class_< X > x( "X" );
x.def( "__init__", make_constructor( make_x ) );
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070202/7f917e34/attachment.htm>
More information about the Cplusplus-sig
mailing list