c++高手请进

loki c++库中有这么一段,这到底是为什么呢,难道类模板允许重载?
还有类模板还可以继承?被打击了
C/C++ code

template <class TList, template <class> class Unit>
    class GenScatterHierarchy;
     
    template <class T1, class T2, template <class> class Unit>
    class GenScatterHierarchy<Typelist<T1, T2>, Unit>
        : public GenScatterHierarchy<T1, Unit>
        , public GenScatterHierarchy<T2, Unit>
    {
    public:
        typedef Typelist<T1, T2> TList;
        typedef GenScatterHierarchy<T1, Unit> LeftBase;
        typedef GenScatterHierarchy<T2, Unit> RightBase;
        template <typename T> struct Rebind
        {
            typedef Unit<T> Result;
        };
    };
     
    template <class AtomicType, template <class> class Unit>
    class GenScatterHierarchy : public Unit<AtomicType>
    {
        typedef Unit<AtomicType> LeftBase;
        template <typename T> struct Rebind
        {
            typedef Unit<T> Result;
        };
    };
    
    template <template <class> class Unit>
    class GenScatterHierarchy<NullType, Unit>
    {
        template <typename T> struct Rebind
        {
            typedef Unit<T> Result;
        };
    };

作者: juzixiangchang   发布时间: 2011-06-15

三个类模板参数个数不同,准确一点叫特化,不叫重载。
类模板继承那是CRTP,即Curiously Recurring Template Pattern

作者: dizuo   发布时间: 2011-06-15

也可以说是低维特化,降维特化。与函数的递归调用十分相似,

作者: dizuo   发布时间: 2011-06-15

建议lz找本c++ template看看,先把模板基础打好

作者: Demon__Hunter   发布时间: 2011-06-15