Boost logo

Boost :

From: Alexander Nasonov (alnsn-boost_at_[hidden])
Date: 2005-06-22 17:34:38


> 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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk