主题:关于模板偏特化问题
在看<c++设计新思维>时遇到了下面一段代码,
[code=c]
template <class TList, template <class> Unit>
class GenScatterHierarchy;
template <class T1, class T2, template<class> Unit>
class GenScatterHierarchy<TYPELIST_2(T1, T2), Unit>
:public GenScatterHierarchy<T1, Unit>
,public GenScatterHierarchy<T2,Unit>
{
};
template <class AutomicType, template <class> Unit>
class GenScatterHierarchy : public Unit<AutomicType>
{
};
template <template <class> Unit>
class GenScatterHierarchy<NullType, Unit>
{
};
[/code]
class GenScatterHierarchy<TYPELIST_2(T1, T2), Unit>
class GenScatterHierarchy<NullType, Unit>
可以理解为
template <class TList, template <class> Unit>
class GenScatterHierarchy;
的偏特化版本, 可是
class GenScatterHierarchy : public Unit<AutomicType>
该怎么理解呢?请指点
[code=c]
template <class TList, template <class> Unit>
class GenScatterHierarchy;
template <class T1, class T2, template<class> Unit>
class GenScatterHierarchy<TYPELIST_2(T1, T2), Unit>
:public GenScatterHierarchy<T1, Unit>
,public GenScatterHierarchy<T2,Unit>
{
};
template <class AutomicType, template <class> Unit>
class GenScatterHierarchy : public Unit<AutomicType>
{
};
template <template <class> Unit>
class GenScatterHierarchy<NullType, Unit>
{
};
[/code]
class GenScatterHierarchy<TYPELIST_2(T1, T2), Unit>
class GenScatterHierarchy<NullType, Unit>
可以理解为
template <class TList, template <class> Unit>
class GenScatterHierarchy;
的偏特化版本, 可是
class GenScatterHierarchy : public Unit<AutomicType>
该怎么理解呢?请指点