Reputation: 75844
The following code
template <class Integral>
using enable_if_integral_t = typename std::enable_if<std::is_integral<Integral>::value>::type;
template <class Integral, class Enable = void>
class DigitsNumber;
template <class Integral>
class DigitsNumber<Integral, enable_if_integral_t<Integral>>{
};
Generates error in MSVC 2013:
error C3203: 'enable_if_integral_t' : unspecialized alias template can't be used as a template argument for template parameter 'Enable', expected a real type
But compiles fine in gcc.
Is this code conforming with the C++11 standard, and a Visual Studio bug/unimplemented feature, or it's not conforming with the standard, but a gcc extension.
Is there any way to make this work in VS?
Thank you.
Upvotes: 3
Views: 1206
Reputation: 1672
I was able to work around this using the link that dyp provided:
template <class Integral>
struct MSVCWorkaround : std::enable_if<std::is_integral<Integral>::value, SomeType> {};
template <class Integral>
using enable_if_integral_t = typename MSVCWorkaround<Integral>::type;
Upvotes: 1