[RFC] Implementing addressof for C++0x

Paolo Carlini paolo.carlini@oracle.com
Thu May 20 11:10:00 GMT 2010


... for reference, it would be something like this (in my recollections,
it was even uglier ;)

template<typename _Tp>
  _Tp*
  addressof(_Tp& __v)
  {
    return reinterpret_cast<_Tp*>
      (&const_cast<char&>(reinterpret_cast<const volatile char&>(__v)));
  }

I'm not sure...

Paolo.



More information about the Gcc mailing list