[C++-sig] Re: using object constructor
Dave Hawkes
daveh at cadlink.com
Fri Jun 21 20:29:26 CEST 2002
"David Abrahams" <david.abrahams at rcn.com> wrote in message
news:147401c2194e$aa1bb040$6601a8c0 at boostconsulting.com...
>
> From: "Dave Hawkes" <daveh at cadlink.com>
>
> > If we want to start wrapping a significant number of functions to return
> > objects is this the best way to do it as it seems inherently unsafe as
> > almost any type of pointer return could be cast in this way.
>
> It's an implementation detail, not for public consumption.
>
So what's the recommended public method, is it
object(handle<>(my_py_object_ptr)) ?
> > Is there any reason why a new template class like borrowed but called
> > (possibly) new_pyobject was not used?
>
> It adds complication and overhead in debug builds.
>
I don't think it would need all the additional support borrowed entails, but
I haven't checked in depth.
> > That way we could get some additional
> > type safety from using new_pyobject<PyObject*> in the constructor
> definition
> > akin to the existing borrowed/null_ok definitions.
>
> Yeah, technically you're right. I am not very happy about all the code
that
> gets generated to handle borrowed, etc. right now though. I'm ambivalent
> about making the change, but would be willing to look at a patch.
>
OK, I may do that if I get more concerned about the issue at some point.
> -Dave
More information about the Cplusplus-sig
mailing list