Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
template for class method problem
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Larry Beck, post: 2547639"] Below is a problem I am having with templates. I am trying to use a template to avoid having multiple class methods that differ only in the return type of the pointer. I have tried putting in another parm of the typename to guarantee the uniqueness of the parm list but it didn’t help. I am getting undefined externals from the linker, one for each elemental type. Any ideas would be appreciated. Thank you, // Class declaration class UTILITY_STUFF { public: template<typename T> T* GetJunk(unsigned int x, unsigned int y); } // Method usage template<typename T> T* UTILITY_STUFF::GetJunk(unsigned int x, unsigned int y) { return (T *)junkFunction(x,y); } // Template template<typename T> bool junk(T* pDummy, unsigned int X, unsigned int Y) { UTILITY_STUFF* someJunk; nitfValue = someJunk->GetPixel<T>(X, Y); } [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
template for class method problem
Top