我有这样的代码:在认定中,以template<typename SceneT, GeneratorType TYPE>
型enum-错误的NoType在模板的专业化:模板参数无效
enum GeneratorType
{
FILE_LIST, DEVICE
};
template<typename SceneT, int TYPE>
class ODFrameGenerator
{
//... some APIS
};
template<typename SceneT>
class ODFrameGenerator<SceneT, GeneratorType::DEVICE>
{
//...specialization: ERROR: template argument 2 is invalid
};
template<typename SceneT>
class ODFrameGenerator<SceneT, 1>
{
//...specialization: compiles fine!!
};
我试图改变template<typename SceneT, int TYPE>
但仍北京时间给出确切的同样的错误。任何想法什么是错的,以及如何避免这种情况?
注意:这是编译与c + + 11(与-std = c + + 11标志);但是否则失败。我正在使用gcc 4.9.2。
编辑:确切的错误我得到的是以下几点:
/home/sarkar/opendetection/common/utils/ODFrameGenerator.h:80:61: error: template argument 2 is invalid
class ODFrameGenerator<ODSceneImage, GeneratorType::DEVICE>
^
/home/sarkar/opendetection/common/utils/ODFrameGenerator.h:100:46: error: wrong number of template arguments (1, should be 2)
class ODFrameGenerator<ODScenePointCloud<> >, GeneratorType::DEVICE>
^
/home/sarkar/opendetection/common/utils/ODFrameGenerator.h:28:9: error: provided for ‘template<class SceneT, int TYPE> class od::ODFrameGenerator’
class ODFrameGenerator
^
/home/sarkar/opendetection/examples/objectdetector/od_image_camera.cpp: In function ‘int main(int, char**)’:
/home/sarkar/opendetection/examples/objectdetector/od_image_camera.cpp:28:67: error: template argument 2 is invalid
od::ODFrameGenerator<od::ODSceneImage, od::GeneratorType::DEVICE> frameGenerator("0");
^
/home/sarkar/opendetection/examples/objectdetector/od_image_camera.cpp:28:83: error: invalid type in declaration before ‘(’ token
od::ODFrameGenerator<od::ODSceneImage, od::GeneratorType::DEVICE> frameGenerator("0");
是您获得的* exact *错误吗?它是*完整*吗? *未经编辑*? –
@JoachimPileborg,我添加了我得到的确切的错误。 – krips89