Help save net neutrality! Learn more.
Close

GenLInearHiearcy

Kimpan
2005-05-08
2013-04-08
  • Kimpan

    Kimpan - 2005-05-08

    Hi
    I have trouble with GenLinearHiearchy usijng VS 2003. I don't know exactly how to use the Field<> template to make it work. I have a family of ActiveX Controls that have many commonalities and few variations. I do not know yet exactly where the variations will submerge and therefor want the flexibility templates provide. I also would like to reduce the overhead using GenScatterHierarchy (Well, in this particular case it doesn't matter. But I want to know how to use GenLinearHiearchy). I would be glad if you could explain how to make it work.Here is the code that doesn't compile:

    template <class T, class Base>
    struct Z : public Base { virtual void f() {} };

    struct X { virtual void f() {} };
    struct Y { virtual void f() {} };

    int main(void)
    {
    using namespace Loki;
    typedef Loki::GenLinearHierarchy<TYPELIST_2(X,Y), Z> EventHandler;
    EventHandler h;
    Field<X>(h),f(); // call X.f()
    Field<Y>(h),f(); // call Y.f() 
    return 0;
    }

     
    • Fraser

      Fraser - 2009-09-01

      Field is only used with hierarchies from GenScatterHierarchy.

       

Log in to post a comment.