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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||