Menu

What is ScatterHierarchyTag means?

2006-01-10
2013-04-08
  • Nobody/Anonymous

    I read the Loki source code, I doubt why use ScatterHierarchyTag head?

    ---------------------------------------------------------------------------­-------------------------------------

    namespace Private
        {

            template<class, class>
            struct ScatterHierarchyTag;
        }

        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<Private::ScatterHierarchyTag<T1,
    T2>, Unit>
            , public GenScatterHierarchy<T2, Unit>
        {
        public:
            typedef Typelist<T1, T2> TList;
            typedef GenScatterHierarchy<Private::ScatterHierarchyTag<T1,
    T2>, Unit> LeftBase;
            typedef GenScatterHierarchy<T2, Unit> RightBase;
            template <typename T> struct Rebind
            {
                typedef Unit<T> Result;
            };
        };

        template <class T1, class T2, template <class> class Unit>
        class GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>,
    Unit>
            : public GenScatterHierarchy<T1, Unit>
        {
        };

        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;
            };

     
    • Fraser

      Fraser - 2009-09-01

      It ensures that multiple base classes are not identical and ambiguous to a derived class.

       

Log in to post a comment.