convert const std::shared_ptr<const T> into boost::shared_ptr<T>

You cannot transfer ownership from std::shared_ptr to boost::shared_ptr. You might from a std::unique_ptr though.

But you can create a boost::shared_ptr with a custom deleter.

boost::shared_ptr<io_adaptor::msg::PandarScan>
    msg_boost(const_cast<io_adaptor::msg::PandarScan*>(msg.get()),
              [msg = msg](auto*) mutable { msg.reset(); });

Demo

Deleter captures original shared_ptr to maintain the lifetime, and instead of releasing the resource, it just "decreases" the refcount.