This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Template error when using templated type in stl::vector


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
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]