Template error when using templated type in stl::vector

Andrew McPherson andrew.mcpherson@gmail.com
Thu Jun 19 03:34:00 GMT 2008


Thanks! That works.

On Wed, Jun 18, 2008 at 8:15 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> 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
>



More information about the Gcc-bugs mailing list