boost::shared_*_cast are deprecated, removed in boost 1.53

Create issue
Issue #581 closed
Steven Peters created an issue

Gazebo has boost::shared_static_cast() and boost::shared_dynamic_cast() function calls in many places, but this function was deprecated as long ago as boost 1.35 (search for deprecated in http://www.boost.org/doc/libs/1_35_0/boost/shared_ptr.hpp) and has been removed in boost 1.53 (latest version). The recommend instead to use boost::dynamic_pointer_cast().

I came upon this while trying to compile on OS X and using the ros/groovy homebrew of ogre, which uses the latest boost version.

Comments (12)

  1. Steven Peters reporter
    for i in $(grep -rnI shared_dynamic_cast . | sed -e 's@:.*@@'); do sed -e 's@shared_dynamic_cast@dynamic_pointer_cast@g' $i > $i.tmp; mv $i.tmp $i; done
    
    for i in $(grep -rnI shared_static_cast . | sed -e 's@:.*@@'); do sed -e 's@shared_static_cast@static_pointer_cast@g' $i > $i.tmp; mv $i.tmp $i; done
    
  2. Steven Peters reporter

    @_jrivero_ I had fixed this issue, but it keeps coming back, since people are in the habit of using boost::shared_dynamic_cast. Do you have any advice for how to add this to tools/code_check.sh?

  3. Jose Luis Rivero

    @scpeters let me work on defining and running our own cppcheck rules to find out this deprecated cases.

  4. Log in to comment