This is the static/template function I have:
template<class T>
static T *createWidget(Vec pos, Module *module, ModuleWidget *moduleWidget, int paramId, float minValue, float maxValue, float defaultValue) {
T *widget = ParamWidget::create<T>(pos, module, paramId, minValue, maxValue, defaultValue);
moduleWidget->mRandomModeWidgets[paramId] = widget;
widget->Module = module;
widget->ModuleWidget = moduleWidget;
return widget;
}
But I'd like to place the declaration on .h
and the definition on .cpp
.
Tried:
template<class T>
static T *createWidget(Vec pos, Module *module, ModuleWidget *moduleWidget, int paramId, float minValue, float maxValue, float defaultValue);
And than:
template<class T>
static T *MyClasss:createWidget(Vec pos, Module *module, ModuleWidget *moduleWidget, int paramId, float minValue, float maxValue, float defaultValue) {
T *widget = ParamWidget::create<T>(pos, module, paramId, minValue, maxValue, defaultValue);
moduleWidget->mRandomModeWidgets[paramId] = widget;
widget->Module = module;
widget->ModuleWidget = moduleWidget;
return widget;
}
But it says a storage class may not be specified here.
Where am I wrong?