|
Boost Users : |
From: Agoston Bejo (gusz1_at_[hidden])
Date: 2004-12-17 20:06:57
Has anyone succeeded in specializing class templates with enable_if under
VC++7.1? I have created the simplest example possible and cannot imagine how
I could rewrite so that no Internal Compiler Error occurs.
I have tried with both the boost 1.31 and 1.32 headers, with no difference.
------------------------------------------------------
#include <iostream>
#include <boost/utility/enable_if.hpp>
#include <boost/type_traits.hpp>
using namespace std;
using namespace boost;
template<typename T, typename E = void>
struct A {
enum { X = 0 };
};
template<typename T>
struct A<T, typename enable_if< typename is_arithmetic<T> >::type>
{
enum { X = 1 };
};
template<typename T>
struct A<T, typename enable_if< typename is_object<T> >::type>
{
enum { X = 2 };
};
struct B {};
int _tmain(int argc, _TCHAR* argv[])
{
// cout << is_arithmetic<double>::value << endl;
typedef A<float> Afloat;
cout << Afloat::X << endl; // Internal Compiler Error
cout << A<int>::X << endl;
cout << A<B>::X << endl;
return 0;
}
------------------------------------------------------
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net