Modify

Ticket #4797 (closed Feature Requests: fixed)

Opened 3 years ago

Last modified 3 years ago

Member hooks do not work with base classes

Reported by: mgaunard Owned by: igaztanaga
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

Change History

comment:1 Changed 3 years ago by viboes

I would consider this as a feature request.

comment:2 Changed 3 years ago by igaztanaga

  • Status changed from new to closed
  • Resolution set to fixed

You can use function_hook to implement this feature in Boost 1.47

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.