Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-06-22 14:13:10


"Alexander Nasonov" <alnsn-boost_at_[hidden]> wrote in message
news:loom.20050622T171035-650_at_post.gmane.org...
> Andy Little <andy <at> servocomm.freeserve.co.uk> writes:
>
>> Isnt any use case for this covered by Boost.Typeof ?
>
> Quote from Boost.Typeof documentation:
>
> Other integral types, such as *enums*, need to be described explicitly with
> the
> BOOST_TYPEOF_INTEGRAL macro, like (BOOST_TYPEOF_INTEGRAL(MyEnum))

I think that applies when the type of the enum is taken, but where required
enums are promoted to some integer type,dependent on numeric value.
In what other situation is promotion required?

#define BOOST_TYPEOF_COMPLIANT
#include <boost/typeof/typeof.hpp>
#include <iostream>

struct X{
    enum id{x,y};
};

int main()
{
    BOOST_AUTO( result , X::x + X::y);
    std::cout << typeid(result).name() <<'\n';
}

Andy Little


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