【发布时间】:2011-06-29 22:18:20
【问题描述】:
好的,我有:
template<typename T>
class Reader
{
class Input
{
template<typename C>
void operator()(C& val) const
{
/* Do Some Work */
}
};
};
不幸的是,“做一些工作”的通用版本对我不起作用。也不容易修改,因为它在一些繁重的模板元编程代码中间。
所以我虽然可以针对我的类型专门化该方法。所以我的第一步是尝试将通用方法从课程中拉出来。
template<typename T>
class Reader
{
class Input
{
template<typename C>
void operator()(C& val) const;
};
};
template<typename T>
template<typename C>
void typename Reader<T>::Input template operator()<C>(C& val) const // LINE 13
{
/* Do Some Work */
}
不幸的是,我收到了错误:
s.h:13: error: error: '&' 标记之前的预期')'
【问题讨论】:
标签: c++ templates specialization template-specialization