In boost::detail::addressof_impl::f() a series of reinterpret_cast
s is done to obtain the actual address of the object in case class T
has overloaded operator&()
:
template<class T> struct addressof_impl
{
static inline T* f( T& v, long )
{
return reinterpret_cast<T*>(
&const_cast<char&>(reinterpret_cast<const volatile char&>(v)));
}
}
What's the purpose of cast to const volatile char&
instead of just casting to char&
?