In a C++ Program, attempting to use templates in a class I'm developing results in my compiler not registering the class constructors declared in the source.
If I remove the template it compile fine, but other that that in the last hour I've made no progress to in what might be wrong (I've tried playing with where and how I declare the template, and namespace syntax's) .
So, what am I failing to understand about C++, please?
rondel.h:
template <typename T>
class RondelGauge: public sf::Drawable, public sf::Transformable {
private:
//No Default constructor
RondelGauge();
//Used to draw the gauge
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
//The data the gauge visualises
T& dataValue;
std::string& label;
std::string& dataUnit;
[Irrelevant code emitted]
public:
//The constructor - No errors thrown in the header.
RondelGauge(T& value, std::string& iLabel, std::string& iUnit);
};
rondel.cpp:
#include "rondel.h"
#include "stdafx.h"
template <typename T>
//This, and variations of it, fail to reguister.
RondelGauge<T>::RondelGauge(T& value, std::string& iLabel, std::string& iUnit) : dataValue(&value), label(&iValue), dataUnit(&iUnit) {
setOrigin(65 / 2, 65, 2);
setPosition()
}