Boost logo

Boost Users :

From: Romain Lerallut (rlerallut_at_[hidden])
Date: 2003-10-02 09:10:17

In the following code, struct foo2 is mistakenly taken for an enum, which
breaks is_class, which leads to some unfortunate problems in boost::python.

Problem appears on both Boost 1.30.0 and a one-month old CVS checkout, using
gcc 3.3.2 and 2.95 and Intel icc 7.1 for linux.

I have tried specializing 'is_enum', setting it by hand to return 'false',
but though it works for this simple case, it does no good when the call to
is_enum is buried deep inside boost.

I rely heavily on being able to do these implicit conversions for foo2, so if
anyone has an idea on how to make this work, it would be great.

Thanks in advance,

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

struct foo1 // this one is not detected as an enum
        operator int() { return 0; }

struct foo2 // this one *is* detected as an enum
        template<typename T> operator T(){return 0;}

int main()

Expected Result:
Actual Result:

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at