I'm currently studying linked lists and had a question about the template implementation. Do I need to include template <typename T> in both the .h and the .cpp. The code is incomplete, but here is what I have so far:
/* Node Function Definitions */
// CLList.cpp
// Should I include the next line in this file or is the declaration in the .h file enough? */
//template <typename T>
#include "CLList.h"
CLList::CLList(T value)
:m_value(value)
{
}
CLList::~CLList()
{
}
Any suggestions you can make that will improve my technique, please let me know.
Templates are different. The implementation (yes it needs template) has to be in the same header file as the class definition. In other words, templated classes and functions don't normally go into source files ;)
Thanks! I was curious as the IDE I am using is currently reporting it as a bug (both included and excluded), although I haven't tried compiling the class yet.