J
josip.krapac
Hi all,
I tried to compile the following code:
<code>
template<typename T>
struct foo {
vector<foo<T> > children;
};
template<typename T>
void g(const foo<T>& a) {
vector<foo<T> >::const_iterator childIt = a.children.begin(); //
error: expected `;' before 'childIt'
}
</code>
But my compiler (gcc version 4.1.2 20061115 (prerelease) (Debian
4.1.1-21)) reports the error (as commented in code).
I guess that the problem is in templates, because non-templatized code
compiles fine:
<code>
struct foo {
vector<foo> children;
};
void g(const foo& a) {
vector<foo>::const_iterator childIt = a.children.begin();
}
</code>
Do you know what I'm doing wrong?
Thank you!
Best,
Josip
I tried to compile the following code:
<code>
template<typename T>
struct foo {
vector<foo<T> > children;
};
template<typename T>
void g(const foo<T>& a) {
vector<foo<T> >::const_iterator childIt = a.children.begin(); //
error: expected `;' before 'childIt'
}
</code>
But my compiler (gcc version 4.1.2 20061115 (prerelease) (Debian
4.1.1-21)) reports the error (as commented in code).
I guess that the problem is in templates, because non-templatized code
compiles fine:
<code>
struct foo {
vector<foo> children;
};
void g(const foo& a) {
vector<foo>::const_iterator childIt = a.children.begin();
}
</code>
Do you know what I'm doing wrong?
Thank you!
Best,
Josip