with -std=c++0x typeof is gone

Patrick Horgan phorgan1@yahoo.com
Thu Jan 28 08:43:00 GMT 2010


me22 wrote:
> On 28 January 2010 01:31, Patrick Horgan <phorgan1@yahoo.com> wrote:
>   
>> In a templated class we define our difference type like this:
>>
>>       typedef typeof(T() - T()) differenceType;
>>
>>     
>
> That works?  Wouldn't it give unsigned when T is unsigned?
>   
Yeah, that's a problem!  Love the decltype solution, but it does the 
same.  So gcc chooses between typeof and decltype with #ifdef 
__GXX_EXPERIMENTAL_CXX0X__
Anyone know if that's always set for -std=c++0x?

Patrick



More information about the Gcc-help mailing list