
5 Aug
2012
5 Aug
'12
11:04 a.m.
paul Fultz wrote:
And if decltype not available, why couldn't it use the conditional expression method described here:
Actually, the rvalue detection techniques in the article could be used to create a better decltype emulation on older compilers. I use this here:
https://github.com/pfultz2/Zelda/blob/master/zelda/typeof.h
Its a macro called ZELDA_XTYPEOF, which in C++11 is the equivalent of decltype(()) with double parenthesis. On older compilers, it will bind to a reference, unless its an rvalue which it will not have a reference.
On C++03-compliant compilers, you cannot use Boost.Foreach's technique to detect rvalueness for classes with a template conversion operator. Regards, Michel