M
Marc.Tajchman
Hi everybody,
Here is a simple C++ example :
1 #include <vector>
2
3 template <typename T>
4 class X {
5 T _t;
6 public :
7 X(const T & t) : _t(t) {}
8 };
9
10 template <typename U >
11 void f(U t)
12 {
13 std::vector< X<U> > v;
14 std::vector< X<U> >::iterator iv;
15 }
16
17 int main()
18 {
19 std::vector<int>::iterator i;
20 std::vector< X<float> >::iterator j;
21 return 0;
22 }
Line 14 gives me the following compiler error (g++ 3.4.1) :
----------------------------------------------------------
test.cxx: In function `void f(U)':
test.cxx:14: error: expected `;' before "iv"
----------------------------------------------------------
but line 20 is accepted.
Could you tell me what's wrong (probably a simple syntax problem,
but I don't see which one) ?
Thanks in advance.
Marc
Here is a simple C++ example :
1 #include <vector>
2
3 template <typename T>
4 class X {
5 T _t;
6 public :
7 X(const T & t) : _t(t) {}
8 };
9
10 template <typename U >
11 void f(U t)
12 {
13 std::vector< X<U> > v;
14 std::vector< X<U> >::iterator iv;
15 }
16
17 int main()
18 {
19 std::vector<int>::iterator i;
20 std::vector< X<float> >::iterator j;
21 return 0;
22 }
Line 14 gives me the following compiler error (g++ 3.4.1) :
----------------------------------------------------------
test.cxx: In function `void f(U)':
test.cxx:14: error: expected `;' before "iv"
----------------------------------------------------------
but line 20 is accepted.
Could you tell me what's wrong (probably a simple syntax problem,
but I don't see which one) ?
Thanks in advance.
Marc