Jump to content
  • Advertisement
Sign in to follow this  
guyaton

template classes

This topic is 4946 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to create a template class withing a template class for a FIFO structor :
template<typename C>
class CFIFO
{
public:
	CFIFO();
	~CFIFO();

	HRESULT PUSH( C *pItem );

	HRESULT POP( C *pItem );

protected:

	template<typename C> 
	class CFIFODATA : public CSingleLinkedList<C>
	{
	public:
		CFIFODATA() { };
		~CFIFODATA() { };

	protected:
		C *m_Data;

	};

	CFIFODATA<C> *m_Data;
};


the problem is when i'm trying to write code for the inner class (CFIFODATA) i'm trying write code for the constructor and i'm getting this error: DirectX error LNK2019: unresolved external symbol "public: __thiscall CFIFO<long>::CFIFODATA<long>::CFIFODATA<long>(void)" (??0?$CFIFODATA@J@?$CFIFO@J@@QAE@XZ) referenced in function "public: __thiscall CFIFO<long>::CFIFO<long>(void)" (??0?$CFIFO@J@@QAE@XZ) This is how i'm trying to do it:
template<typename C> CFIFO<C>::CFIFODATA<C>::CFIFODATA()
{
	this->m_Data = NULL;
	this->m_Next = NULL;
}

probably something i'm overlooking right?

Share this post


Link to post
Share on other sites
Advertisement
e:\programming\Parser\FIFO.h(64): error C3206: 'CFIFO<C>::CFIFODATA::CFIFODATA' : member functions of nested classes of a template class cannot be defined outside the class


haha...tell me that's not funny. Guess i have to do the nested version! thanks mike!

Share this post


Link to post
Share on other sites
That's a limitation of ms compilers. Also it can hit serious problems if your templates get too complicated
(Well that's all I've got to contribute)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!