+1  A: 

boost::shared_array has a constructor that takes a deleter as a second argument to be used instead of default delete[].

This means you might be able to pass the address of a suitable deallocation function just like that.

boost::shared_array<X> array(allocate_x(100), &deallocate_x);  

References: Boost.SharedArray

UncleBens