- First you have
__rwhich is of type_Tp& - It is
reinterpret_cast‘ed to achar&in order to ensure being able to later take its address without fearing an overloadedoperator&in the original type; actually it is cast toconst volatile char&becausereinterpret_castcan always legally addconstandvolatilequalifiers even if they are not present, but it can’t remove them if they are present (this ensures that whatever qualifiers_Tphad originally, they don’t interfere with the cast). - This is
const_cast‘ed to justchar&, removing the qualifiers (legally now!const_castcan do whatreinterpret_castcouldn’t with respect to the qualifiers). - The address is taken
&(now we have a plainchar*) - It is
reinterpret_cast‘ed back to_Tp*(which includes the originalconstandvolatilequalifiers if any).
Edit: since my answer has been accepted, I’ll be thorough and add that the choice of char as an intermediate type is due to alignment issues in order to avoid triggering Undefined Behaviour. See @JamesKanze’s comments (under the question) for a full explanation. Thanks James for explaining it so clearly.