Modify

Ticket #3489 (closed Feature Requests: fixed)

Opened 5 years ago

Last modified 4 years ago

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

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

Change History

Changed 5 years ago by anonymous

comment:1 Changed 4 years ago by igaztanaga

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

Added function_hook for Boost 1.45 in release branch

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.