[英]Specialize function template result
我是模板元编程的新手,在这种方法中找不到我的思维错误:
template <typename T>
typename T::ReturnType Query(const std::string& Str);
template <>
ResultTypeRowCount Query(const std::string& Str) { return this->queryRowCount(Str); }
ResultTypeRowCount实现名称为ReturnType的公共typedef
谢谢您的阅读
它应该是:
template <>
ResultTypeRowCount::ReturnType Query<ResultTypeRowCount>(const std::string& Str) { return this->queryRowCount(Str); }
专门化模板应遵循以下模式:
template<typename T>
void foo() {
}
template<>
void foo<int>() {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.