Raised This Month: $51 Target: $400
 12% 

Function template..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 04-25-2007 , 13:36   Function template..
Reply With Quote #1

Hey,

Wondering if anyone could gimme a hand with this, I'm trying to declare a pointer to a template class and I'm having trouble with it.
This is what I got...
Code:
class CNetworkColor32Base : public CNetworkVarBase< Type, Changer >

...

CNetworkColor32Base cColour32<unsigned char>;
The error I'm getting is...
Quote:
\ZombiePlugin.cpp(4601) : error C2955: 'CNetworkColor32Base' : use of class template requires template argument list
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 04-25-2007 , 16:30   Re: Function template..
Reply With Quote #2

CNetworkColor32Base<unsigned char> cColour32;

A pointer would just be:
CNetworkColor32Base<unsigned char> *cColour32;
I believe.
sslice is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 04-26-2007 , 03:09   Re: Function template..
Reply With Quote #3

But the template takes two arguments? < Type, Changer >
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 04-26-2007 , 16:38   Re: Function template..
Reply With Quote #4

Ohh.. it inherits the template class. You should just be able to do CNetworkColor32Base cColour32;
sslice is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 04-27-2007 , 14:03   Re: Function template..
Reply With Quote #5

Quote:
Originally Posted by sslice View Post
Ohh.. it inherits the template class. You should just be able to do CNetworkColor32Base cColour32;
Nope definitely can't do that, get the same errors.
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
showdax
Senior Member
Join Date: Dec 2004
Old 04-27-2007 , 15:35   Re: Function template..
Reply With Quote #6

Do you actually need to use any methods or members the class provides? If not, you could just hold on to it as void*. Otherwise, you'll need to satisfy that second template argument--there's no default for it.

CBaseEntity looks like a valid Changer class; its NetworkStateChanged(void*) method looks similar to the one created by the NETWORK_VAR_END macro. There may be other classes that work in this context, but obviously you'll need to know which to use.
showdax is offline
Send a message via MSN to showdax
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 04-28-2007 , 07:52   Re: Function template..
Reply With Quote #7

Hey thanks for your help but LDuke showed me a way to use it without this network var.

Cheers Dukey!
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode