On 2011-10-5 19:00, Jim Bosch wrote:
On 10/05/2011 11:31 AM, Holger Brandsmeier wrote:
Jim,

how do you handle smart_ptr<const T> in boost python? Do you simply
cast away the constness?


For my custom smart pointer I provide a class extending
to_python_converter<Teuchos::RCP<T>, rcp_to_python<T>, true>
now I decided to also implement
to_python_converter<Teuchos::RCP<const T>, rcp_to_python_const<T>, true>
where I simply cast away the constness and use the above implementation.

This seems to be working so far. Did you provide a smarter
implementation for shared_ptr<const T>?


Personally, I pretty much always use shared_ptr, and I've written a
rather large extension to support constness on the Python side, and
dealing with shared_ptr<const T> is a side effect of that.

I'm welcome to pass it on if you're interested, but I don't think it
really addresses your problem.

I would be definitely be interested in seeing how you're handling const objects.

Wichert.

--
Wichert Akkerman <[email protected]>   It is simple to make things.
http://www.wiggy.net/                  It is hard to make things simple.
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to