Template error when using templated type in stl::vector

2008-06-18 Thread Andrew McPherson
// Neither of the following compile, though they do in visual studio.

template
struct MyStruct
{
MyStruct()
{
std::vector::iterator i; 
}
};

template
struct MyStruct1
{
MyStruct1()
{
std::vector*>::iterator i;  
}
};


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

2008-06-18 Thread Andrew McPherson
Thanks! That works.

On Wed, Jun 18, 2008 at 8:15 PM, Andrew Pinski <[EMAIL PROTECTED]> wrote:
> On Wed, Jun 18, 2008 at 11:06 PM, Andrew McPherson
> <[EMAIL PROTECTED]> wrote:
>> // Neither of the following compile, though they do in visual studio.
>>
>> template
>> struct MyStruct
>> {
>>MyStruct()
>>{
>
>>std::vector::iterator i;
>
> You missed the typename keyword.
> That is it should be "typename std::vector::iterator i;"
>
>>}
>> };
>>
>> template
>> struct MyStruct1
>> {
>>MyStruct1()
>>{
>>std::vector*>::iterator i;
>
> Likewise.
> typename std::vector*>::iterator i;
>
>
> -- Pinski
>


Template problems

2008-06-24 Thread Andrew McPherson
The following code causes this gcc error:
test.c: In member function `void Test2::Initialize()':
test.c:22: error: expected primary-expression before '>' token
test.c:22: error: expected primary-expression before ')' token


template 
class Test1
{
public:
template 
void TestMe()
{
}
};

struct Nothing2
{
};

template 
class Test2
{
public:

void Initialize()
{
mTest.TestMe();
}

Test1 mTest;
};

struct Nothing
{
};

void TestFunc()
{
Test2 as;

as.Initialize();
}