-2
我有一个模板类中定义的typedef:呼叫类型定义的构造函数中的模板
template <class T>
class ROIAlg{
public:
typedef std::vector<T> Waveform;
typedef typename Waveform::const_iterator Tick;
typedef std::pair<Tick, Tick> Region;
//etc.
};
,并使用它们
template <class T>
class WaveformPropertiesAlg{
public:
WaveformPropertiesAlg();
private:
typename ROIAlg<T>::Region fCPR;
//etc.
};
WaveformPropertiesAlg的构造函数的实现其他类:
template <class T>
WaveformPropertiesAlg<T>::WaveformPropertiesAlg():
fCPR(ROIAlg<T>::Tick(), ROIAlg<T>::Tick()) {
//etc
}
另一段代码试图构造一个WaveformPropertiesAlg<short int>
但comp平息失败:
In instantiation of ‘WaveformPropertiesAlg<T>::WaveformPropertiesAlg() [with T = short int]’:
RawDigitAndWireComparisonAlg.cxx:13:77: required from here
WaveformPropertiesAlg.h:30:51: error: dependent-name ‘ROIAlg<T>::Tick’ is parsed as a non-type, but instantiation yields a type
fCPR(ROIAlg<T>::Tick(),ROIAlg<T>::Tick())
^
WaveformPropertiesAlg.h:30:51: note: say ‘typename ROIAlg<T>::Tick’ if a type is meant
我不认为这里是一个类型,因为我调用了Tick的构造函数。我怎样才能做到这一点?
需要告诉编译器'ROIAlg :: Tick'是一个typename。 –
2015-02-06 23:26:53
我们可以每隔多久进行一次这样的活动?为什么没有人阅读他们的编译器的错误信息,但只是丢弃它们? – Walter 2015-02-06 23:31:31