This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Template error when using templated type in stl::vector
- From: "Andrew Pinski" <pinskia at gmail dot com>
- To: "Andrew McPherson" <andrew dot mcpherson at gmail dot com>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 18 Jun 2008 23:15:13 -0400
- Subject: Re: Template error when using templated type in stl::vector
- References: <41f90da70806182006k5950046t8931c65bb72777c0@mail.gmail.com>
On Wed, Jun 18, 2008 at 11:06 PM, Andrew McPherson
<andrew.mcpherson@gmail.com> wrote:
> // Neither of the following compile, though they do in visual studio.
>
> template<typename TParam>
> struct MyStruct
> {
> MyStruct()
> {
> std::vector<MyStruct*>::iterator i;
You missed the typename keyword.
That is it should be "typename std::vector<MyStruct*>::iterator i;"
> }
> };
>
> template<typename TParam>
> struct MyStruct1
> {
> MyStruct1()
> {
> std::vector<class MyStruct1<TParam>*>::iterator i;
Likewise.
typename std::vector<class MyStruct1<TParam>*>::iterator i;
-- Pinski