Possible Duplicate:
How to use enable_if to enable member functions based on template parameter of class
I have a class template:
template<typename T, size_t N> class Vector
I want to enable constructors for specific N
, so I do:
Vector(typename boost::enable_if_c<N==2, T>::type const &e0, T const &e1) {
data[0] = e0;
data[1] = e1;
}
But compiler (MSVC 2010 SP1) gives me an error instead of applying SFINAE. The error is:
error C2039: 'type' : is not a member of 'boost::enable_if_c<B,T>'
with
[
B=false,
T=float
]
What is the problem? Is it a known problem? How can I fix it? Is it the only solution to use static_assert
?
Edit: GCC does not succeed either: http://ideone.com/7Ejo8