Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-07-15 12:17:28


bringiton bringiton wrote:
> On 7/15/06, bringiton bringiton <kneeride_at_[hidden]> wrote:
>> sorry this is not a boost question, but wondering whether you guys
>> could help with templates. I want to place template parameters on a
>> class's member function. however it does not work:
>>
>> class Test {
>> public:
>> template <class T>
>> void DoTest(T t) {
>> cout << t;
>> }
>> };
>>
>> Test t;
>> t.DoTest<int>(2); //error C2062: type 'int' unexpected
>>
>>
>> is it possible to do this?
>>
>
> aah, someone said this works on 7.1
> im using ms vc++ 6
>
> maybe time to upgrade my compiler ;)

Yes, you need to. vc6 has bugs with member templates that were never fixed
AFAIK. There was one, as I recall, where something like what you are doing
would compile incorrectly leading to nasty, hard to debug runtime errors...

Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net