This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: with -std=c++0x typeof is gone
- From: Ian Lance Taylor <iant at google dot com>
- To: phorgan1 at yahoo dot com
- Cc: GCC-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 27 Jan 2010 22:53:11 -0800
- Subject: Re: with -std=c++0x typeof is gone
- References: <4B612F3E.5040409@yahoo.com>
Patrick Horgan <phorgan1@yahoo.com> writes:
> In a templated class we define our difference type like this:
>
> typedef typeof(T() - T()) differenceType;
>
> How simple, how elegant, but typeof is not part of the C++ standard,
> and isn't available when we use -std=c++0x. Other than using
> specializations for each type that we might use with this class, is
> there some other equivalently simple way to do this?
g++ should support __typeof__ even with -std=c++0x.
Ian