Modify

Opened 8 years ago

Closed 7 years ago

#3489 closed Feature Requests (fixed)

using member objects as hooks

Reported by: anonymous Owned by: igaztanaga
Milestone: Boost 1.41.0 Component: intrusive
Version: Boost 1.40.0 Severity: Problem
Keywords: Cc:

Description

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

comment:1 Changed 7 years ago by igaztanaga

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

Added function_hook for Boost 1.45 in release branch

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain igaztanaga.
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.