Boost logo

Boost :

From: Alexander Nasonov (alnsn-boost_at_[hidden])
Date: 2005-06-27 15:07:29


David Abrahams <dave <at> boost-consulting.com> writes:
> "Alexander Nasonov" <alnsn-boost <at> yandex.ru> writes:
>
> > Class template integral_promotion<T> returns promoted type for all types
> > listed in [conv.prom] except bit-fields. For other types it's noop. If
> > you're interested I can try to boostify it.
>
> I'm interested. I don't have an immediate need but I think it's
> important anyway.

I've uploaded promote.tar.gz to http://boost-sandbox.sourceforge.net/vault/
In principle, tests compile on VC free version, various versions of gcc (>=3.2.
2), borland (without enums) and SunPro 5.3.

I'm still not sure about an interface. Metafunction is called promote_integral.
It recogizes cv qualifiers but discards them. References are not promoted.
That is,

short cv -> int
short cv& -> short cv&
std::string cv -> std::string
std::string cv& -> std::string cv&

Rationale for this is to be close to rvalues but the result isn't satisfactory.
I'll rework it as soon as I find better solution.

--
Alexander Nasonov

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