template classes

Started by
5 comments, last by ProPuke 19 years, 3 months ago
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?
~guyaton
Advertisement
did you put every thing into a .h file?
yeah...its all in the same .h file

~guyaton
does it work if CFIFODATA is not a templated class?
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!

~guyaton
just put all of the functions inside the classes
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)
_______________________________ ________ _____ ___ __ _`By offloading cognitive load to the computer, programmers are able to design more elegant systems' - Unununium OS regarding Python

This topic is closed to new replies.

Advertisement