Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Using XS To Wrap A C++ Smart Pointer

by williams (Beadle)
on Sep 29, 2009 at 18:39 UTC ( #798174=note: print w/ replies, xml ) Need Help??

in reply to Using XS To Wrap A C++ Smart Pointer

I was able to follow the typemap suggestion, adding a mapping that eliminates most cases of the repeated code I wanted to avoid. It's slightly nefarious, since I'm sneaking around the back of the smart pointer, accessing the underlying pointer directly, but I think it's justified within these internals.

An issue I didn't mention in the original post was that the smart pointers were pointing at objects belonging to a large class hierarchy. I'm using boost::shared_ptr for this, since it provides nice support for implicit conversions from smart pointers to derived classes, to smart pointers to their base classes. Dealing with this in the XS required writing a small class hierarchy that wraps these smart pointers, but restores the original class hierarchy that the smart pointers concealed.

Thanks for the help.


Comment on Re: Using XS To Wrap A C++ Smart Pointer
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://798174]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-07-05 21:43 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (68 votes), past polls