Both Visual C++ 10.0 and MinGW g++ 4.6.1 lack std::underlying_type, but both accept this code:
template< class TpEnum >
struct UnderlyingType
{
typedef typename conditional<
TpEnum( -1 ) < TpEnum( 0 ),
typename make_signed< TpEnum >::type,
typename make_unsigned< TpEnum >::type
>::type T;
};