Possible Duplicate:
C++: Why can’t I use float value as a template parameter?
I have this class:
template<typename ValueType, ValueType DefaultValue>
class SomeClass
{
public:
SomeClass() : m_value(DefaultValue){}
ValueType m_value;
};
I want to use it like this:
SomeClass<int, 1> intObj; //ok
SomeClass<float, 1.f> floatObj; //error: 'float' : illegal type for non-type template parameter 'DefaultValue'
Can you please explain me why I get this error when using float
?
I want to use something similar to represent RGBA colors and to initialize the channels with default value for different color representations(White for example).