Opened 12 years ago

Closed 12 years ago

#4797 closed Feature Requests (fixed)

Member hooks do not work with base classes

Reported by: Mathias Gaunard Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: intrusive
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

It is not possible to do the following:

struct A
{
    list_member_hook<> hook;
};

struct B : A
{
};

typedef list<B, member_hook<A, list_member_hook<>, &A::hook> > mylist;

(Note &B::hook has type list_member_hook<> A::*, so putting B as the first parameter to member_hook doesn't work.)

This results in a static assert that A and B are not the same type.

The best way to fix this might be to add a base_member_hook<B, A, &A::hook> helper.

Change History (2)

comment:1 by viboes, 12 years ago

I would consider this as a feature request.

comment:2 by Ion Gaztañaga, 12 years ago

Resolution: fixed
Status: newclosed

You can use function_hook to implement this feature in Boost 1.47

Note: See TracTickets for help on using tickets.