
22 Jun
2005
22 Jun
'05
10:34 p.m.
FWIW, something like this: template<class T> struct promoted { typedef BOOST_TYPEOF_TPL(T()+T()) type; };
Unary plus is slightly shorter then binary plus: BOOST_TYPEOF_TPL(+T()) :)
Would work on any integral type without registration. Enums can't be the result of a promotion, so no need to worry about their registration.
My code is very lightweight typeof simulation with only four types: 1 - int 2 - unsigned int 3 - long 4 - unsigned long BTW, I forgot to add wchar_t support to posted integral_promotion.hpp. -- Alexander Nasonov