M
Mike Alexeev
What is the correct syntax for default values to member function
templates?
Here is my example:
1 struct A
2 {
3 typedef int typeA;
4 };
5
6 struct B
7 {
8 template<class Y>
9 void f(typename Y::typeA = typename Y::typeA()) {}
10 };
11
12 int main()
13 {
14 B t;
15 t.f<A>(4);
16 return 0;
17 }
Sun Workshop 6.2 compiler complains about line 9 with the following
message: Operand expected instead of "typename".
G++ 3.1.1 handles it without any problem.
Any help would greatly appreciated.
templates?
Here is my example:
1 struct A
2 {
3 typedef int typeA;
4 };
5
6 struct B
7 {
8 template<class Y>
9 void f(typename Y::typeA = typename Y::typeA()) {}
10 };
11
12 int main()
13 {
14 B t;
15 t.f<A>(4);
16 return 0;
17 }
Sun Workshop 6.2 compiler complains about line 9 with the following
message: Operand expected instead of "typename".
G++ 3.1.1 handles it without any problem.
Any help would greatly appreciated.