Boost logo

Boost Users :

From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2004-12-18 00:08:27


I don't have access to VC++ 7.1 right now, so I can't find the whole
problem you're having, but I have one comment: the uses of typename
before is_arithmetic and is_object are unnecessary, since the types you're
accessing are not members. I don't know if it will solve your ICE
problem, but try removing those uses of typename. Otherwise, try using
enable_if_c and adding ::value after the conditions (but still without a
typename inside the condition for enable_if_c).

                                                        Jeremiah Willcock

On Sat, 18 Dec 2004, Agoston Bejo wrote:

> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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