Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2005-08-17 04:57:35


Hi again,
"Paul Mensonides" <pmenso57_at_[hidden]> wrote

> There shouldn't be a way to legally get it into a template to begin with.
> Template parameters cannot be bound to unnamed types. In other words, there
> is
> no context in which you could have an anonymous enum without already knowing
> that it is anonymous.

FWIW This compiles in VC7.1 notwithstanding that the unnamed enum gives the
wrong result, which of course is probably the problem in the original code as
Thomas Witt says.

#include <iostream>
#include "boost/type_traits/is_enum.hpp"
#include <boost/typeof/typeof.hpp>

enum {X,Y};
enum named{XX,YY};
int main()
{
    bool b0 = boost::is_enum<BOOST_TYPEOF(X) >::value;
    std::cout << b0 <<'\n';
    bool b1 = boost::is_enum<BOOST_TYPEOF(XX) >::value;
    std::cout << b1 <<'\n';
}
output:
0
1

Andy Little


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