template specilization using member enums

Posted by Altan on Stack Overflow See other posts from Stack Overflow or by Altan
Published on 2010-12-28T04:48:36Z Indexed on 2010/12/28 4:53 UTC
Read the original article Hit count: 163

Filed under:
|
struct Bar {
  enum { Special = 4 };
};

template<class T, int K> struct Foo {};
template<class T> struct Foo<T::Special> {};

Usage:

Foo<Bar> aa;

fails to compile using gcc 4.1.2 It complains about the usage of T::Special for partial specilization of Foo. If Special was a class the solution would be to a typename in front of it. Is there something equivalent to it for enums (or integers)?

Thanks,

Altan

© Stack Overflow or respective owner

Related posts about c++

Related posts about templates