S
Scott Frazer
I'm trying to do some template specialization and can't get it to work
quite right. I have a templated base class:
template <typename T> class SignalBase {
...
};
and a derived class:
template <typename T> class Signal : public SignalBase<T> {
...
};
Now I want to do some specialization. This kind works:
template <> class Signal<uint64> : public SignalBase<uint64> {
...
};
but when I try to do a sort of templated-specialization thing:
template <unsigned WIDTH> class Signal<Bits<WIDTH> > : public
SignalBase<Bits<WIDTH> > {
...
};
and declare a variable with it:
Signal<Bits<12> > someSignal;
the compiler "ignores" this specialization in favor of using the
original derived class. Any suggestions?
Scott
quite right. I have a templated base class:
template <typename T> class SignalBase {
...
};
and a derived class:
template <typename T> class Signal : public SignalBase<T> {
...
};
Now I want to do some specialization. This kind works:
template <> class Signal<uint64> : public SignalBase<uint64> {
...
};
but when I try to do a sort of templated-specialization thing:
template <unsigned WIDTH> class Signal<Bits<WIDTH> > : public
SignalBase<Bits<WIDTH> > {
...
};
and declare a variable with it:
Signal<Bits<12> > someSignal;
the compiler "ignores" this specialization in favor of using the
original derived class. Any suggestions?
Scott