Support both Boost and STL shared pointers.