the header mycomputationclass.h
:
#pragma once
template<typename numberType, bool increaseByOne>
class MyComputationClass
{
numberType a = 1;
numberType b = 2;
numberType compute();
};
#include mycomputationclass.hpp
the header implementation file mycomputationclass.hpp
:
#pragma once
#include mycomputationclass.h
template<typename numberType, bool increaseByOne>
numberType MyComputationClass<numberType, increaseByOne>::compute()
{
return a + b;
}
template<typename numberType>
numberType MyComputationClass<numberType, true>::compute()
{
return a + b + static_cast<numberType>(1);
}
the error:
error: invalid use of incomplete type ‘class MyComputationClass<numberType, true>’
numberType MyComputationClass<numberType, true>::compute()
^
All topics related to specialisation I find are using only one template. Can anyone please help me out here?