заголовок mycomputationclass.h
:
#pragma once
template<typename numberType, bool increaseByOne>
class MyComputationClass
{
numberType a = 1;
numberType b = 2;
numberType compute();
};
#include mycomputationclass.hpp
файл реализации заголовка 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);
}
ошибка:
error: invalid use of incomplete type ‘class MyComputationClass<numberType, true>’
numberType MyComputationClass<numberType, true>::compute()
^
Все темы, связанные Для специализации я нахожу использование только одного шаблона. Может кто-нибудь помочь мне здесь?