Folk,

I have an object which serves as a header to a "page" of memory which I serialize by simply writing out.  I deserialize by reading the page and then doing a bit of fixup.  I do this for performance (no copies other than the I/O in both directions).  The header has an intrusive list pointer.  

When I reload the page, I must clear the header from the intrusive list.  The page has  been relocated (it may not be in the same physical location as it was when it was written).  Thus, a simple unlink does not work.  I was unable to figure out how to re-init the pointer when I had a base_hook.  So, I switched to a member hook supposing that I could simply clear the contents of the hook (violating the abstraction) on the reload.  

Unfortunately, the headers are members of a hierarchy.  The member_hook is defined in the base class and it is used in a subclass.  I abstracted the problem into the following code:

#include <boost/intrusive/list.hpp>

class Foo {
    public:
        boost::intrusive::list_member_hook<> hook_;
};

class Bar : public Foo {
    public:
        int x;
};

class BigMess {

    typedef boost::intrusive::member_hook<Bar, boost::intrusive::list_member_hook<>, &Bar::hook_> mho;
    typedef boost::intrusive::list<Bar, mho> BarList;

    BarList list;

};

This fails to compile using g++ (GCC) 4.4.0 on centos 2.6.18-128.1.16.el5 with:

foo.cpp:15: error: could not convert template argument ‘&Foo::hook_’ to ‘boost::intrusive::list_member_hook<> Bar::*’

Clearly, the type of the base class is taken to not be compatible with the subclass.  It is not clear why, however.

Any thoughts would be appreciated as to how to either fix the inheritance problem or how to clear the base_hook case (which does compile and runs, by the way :-)

Thanks

-steve