SFINAE applied to class definitions?

Hi.

I want to use the SFINAE concept to enable/disable a class at compile time.

1
2
3
4
5
6
7
8
9
10
11
12
13
template<typename = typename std::enable_if<std::is_same<int, int>::value>::type>
class Point
{
private:
	double x;
	double y;
};

int main()
{
	Point p1;
	return 0;
}


Since int and int are the same, it should compile. But the compiler says:

'Point': use of class template requires template argument list

and

p1 unknown size

Any help?
This is valid C++17, but pre-C++17 would need line 11 to read Point<> p1.

The expression being tested for validity typically depends on a template argument, so there would usually be something in those angle brackets anyway.
Oh hadn't set Visual Studio to support C++17! Thanks
Topic archived. No new replies allowed.