This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Implementing addressof for C++0x
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, Peter Dimov <pdimov at pdimov dot com>
- Date: Thu, 20 May 2010 13:16:06 +0200
- Subject: Re: [RFC] Implementing addressof for C++0x
- References: <4BF50A18.20406@oracle.com> <4BF5188B.2070904@oracle.com>
On 05/20/2010 01:10 PM, Paolo Carlini wrote:
> ... 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)));
> }
>
By the way, Peter (I think you are the author of the current boost
implementation, which I looked at yesterday), in case we end up having
something like the above, temporarily at least, which kind of
acknowledgment would you be Ok with? Is it enough your name in the
ChangeLog?
Thanks,
Paolo.