Modify

Opened 7 years ago

Closed 7 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.

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by viboes

I would consider this as a feature request.

comment:2 Changed 7 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

You can use function_hook to implement this feature in Boost 1.47

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.