Sign in to follow this  

template classes

This topic is 4733 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
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

This topic is 4733 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this