![]() |
Calling template member functions??
I don't get it.....
Code:
template <class Dummy> class TTest Quote:
Code:
pTest->template CallFunc<CTest>(pTest, CTest::bleh); Quote:
|
Re: Calling template member functions??
i have no clue what templates do, to me the above code looks like bloatware?
|
Re: Calling template member functions??
LOL @Stefan :D He's talking about the C++ templates, which are a pre-made set of types and tools that can supposedly be used out of the box in any C/C++ program. It features linked lists, binary trees, hashtables, etc.
@Rick: never used them. Dunno :) Perhaps you can get a hint on how to use passed pointers to reference functions by looking at the AStarSearch() function in Count Floyd's POD-bot source code. He passes functions addresses as parameters of this function. It sounds like a pointer indirection problem, anyhow. |
Re: Calling template member functions??
ehh templates are normal c++ Stefan :) So is the rest except the line whith the error I guess.
http://www.cplusplus.com/doc/tutorial/tut5-1.html meh to late :) I did some searching the problem is that int his line; pTest->CallFunc<CTest2>(pTest, CTest::bleh); the compiler sees the '<' and the '>' as less-and greater then operators... After I searched a bit in my book it sayed you have to use the template keyword like I did but it seems that msvc 6.0 this doesn't support :( |
Re: Calling template member functions??
yes i know C++ has templates, still sounds like bloatware. I have read enough theories about "you can use your classes in other programs" , and i only got that working ONCE in my entire life...
|
Re: Calling template member functions??
heh problem solved....
http://forums.thewavelength.net/inde...=0&#entry83190 |
Re: Calling template member functions??
@stefan : template are often a great feature, I use them in my AStar code as you might have seen. But don't try to use them when wanting them to access via dynamic linking from a .dll for example, that's scary and results in more work than using another possibility, I once tried that in a NN - simulator ...
and yes, rick, that <...> stuff is mostly only needed when instantiating data elements. your problem is of course a bit more complicated, a template function inside a template class ... maybe you should try to compose classes using virtual base classes and multilayered template constructs .... I guess that'd be almost the summit of crazyness ... I'm using some virtual base class in my bot - in theory everything is fine, but some fuckin' compilers don't like each part of those, creating warnings etc.. you won't guess which one ;) |
Re: Calling template member functions??
hmm virtual base classes is one of those subjects i haven't read much on yet ;)
But its working now, as long the compiler can find the right types for the variabeles all works fine. |
All times are GMT +2. The time now is 04:50. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.