Could someonc help me, I am trying to figure out how to upcast, using Loki SmartPtr.
I have moved some of my codebase from Boost's smart_ptr to Loki, the boost libraries supplies a dynamic_pointer_cast function to allow upcasting from a Base to a Derived class, how can I achieve same thing using Loki SmartPtr?
Unfortunately, neither Loki's SmartPtr nor StrongPtr has an upcast mechanism at this time. I've heard of occasional requests for an upcast conversion constructor, and there is even a request to add this feature. (Feature #1447423)
Hmm, that's a shame, do you know of anywhere that may have submitted a patch to add this functionality. I am fairly confident with templates, but the Loki library takes them to the extreme so I wouldn't want to mess that up.
Unfortunately, I know of no place that offers a patch for this particular need. I checked the patches already submitted to Loki, and neither of them mention the upcasting issue. Someday, I might look at how Boost provides the upcasting ability and duplicate that trick inside Loki. If you come up with a method first, feel free to submit it as a patch.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.