• Jason Rhinelander's avatar
    Switched to virtual CRT trampoline class inheritance · 8243ff92
    Jason Rhinelander authored
    Trampoline inheritance is something of a nuissance because all of the
    base class methods need to be repeated.  I was doing this with some
    defines that shoehorned common methods into each Member subclass, but
    that was messy.
    
    This approach (using "Curiously Recursive Templates") is nicer: each
    PyWhatever class is templated with its base class, so that
    PyFirmNoProd<FirmNoProd> ends up with inheritance path:
    
        PyFirmNoProd<FirmNoProd> : PyFirm<FirmNoProd> : PyAgent<FirmNoProd> :
        PyMember<FirmNoProd> : FirmNoProd : Firm : Agent : Member
    
    This is still a lot of duplication, but it's mainly at the compiler
    level which makes maintenance easier and keeps the code a bit cleaner.
    8243ff92
members.hpp 1.63 KB