
Lars Hagström escribió:
Yes, but it has to be safer and more correct to use static_pointer_casts instead of reinterpret_cast. In my particular situation I am unfortunately not able to use templates, so I do need to do "ugly" pointer stuff. (I am porting an existing shared-memory solution to boost::interprocess).
I've uncommented the static_pointer_cast et al functions from offset_ptr.hpp, and they appear to do their work beautifully.
Lars
Sorry for the late reply. Originally I wrote static_pointer_cast & co.
functions to mimic shared_ptr. I even used them as generic casting
function for code where the pointer type is templated.
However, those functions need an explicit template argument so ADL was
not activated (say, like when you use an unqualified swap call). In the
end I decided to comment them to prevent users using them (I should have
erased them...).
You can achieve the same using:
offset_ptr(static_cast