Opened 8 years ago

Closed 7 years ago

#3489 closed Feature Requests (fixed)

using member objects as hooks

Reported by: anonymous Owned by: Ion Gaztañaga
Milestone: Boost 1.41.0 Component: intrusive
Version: Boost 1.40.0 Severity: Problem
Keywords: Cc:


boost intrusive supports base hooks and member hooks, but if you need something like the following you're off to writing value and node traits:

struct B : list_base_hook<>{};

struct A{

B *b;


the value type of the list should be A, not B, so neither a base_hook nor a member hook can be used here.

so I suggest to add code like the one attached to this ticket, which allows you to do this:

struct get_b{

B &operator()(A const &a){

assert(a.b); return *a.b;



list<A,member_object_hook<A,list_base_hook<>,get_b> > mylist;

Attachments (1)

member_object_list.hpp (2.6 KB) - added by anonymous 8 years ago.

Download all attachments as: .zip

Change History (2)

Changed 8 years ago by anonymous

Attachment: member_object_list.hpp added

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

Resolution: fixed
Status: newclosed

Added function_hook for Boost 1.45 in release branch

Modify Ticket

Change Properties
Set your email in Preferences
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.