Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Intrusive] Compilation error with Visual Studio 2008
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-03-13 16:52:20


AMDG

info-tibo wrote:
> For this class I can't use base hooks - except if there are no
> solutions (for code design)...
>
> I have another file with similar classes and a base hook, and it
> works, apparently because the list is defined in another class than in
> the class of the hook
> i.e, the following works flawlessly:
> class A {
> public:
> BaseHookType hook;
> }
> class B {
> public:
> List<BaseHookType,&A::hook> lst;
> }
>
> Are there really no solutions to use member_hook

Apparently it works if you add an extra level of indirection:

template<class>
struct make_member_hook {
    typedef
boost::intrusive::member_hook<EqualRefSystem,EqualRefSysHook,&EqualRefSystem::ERSMemberHook>
type;
};

//! Objects that reference this EqualRefSystem
boost::intrusive::list< EqualRefSystem,
    typename make_member_hook<EqualRefSystem>::type,
    boost::intrusive::constant_time_size<false> > ReferencedBy;

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net