upcasting SmartPtr

Help
JoePub
2009-06-24
2013-04-08
  • JoePub

    JoePub - 2009-06-24

    Hi,

    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?

    Thanks.

     
    • Richard Sposato

      Richard Sposato - 2009-06-26

      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)

      https://sourceforge.net/tracker/?func=detail&aid=1447423&group_id=29557&atid=396647

      - Rich

       
      • JoePub

        JoePub - 2009-06-26

        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.

        Thanks

         
        • Richard Sposato

          Richard Sposato - 2009-06-28

          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.

          Thanks!

          Rich

           

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks