intrusive-containers

std::forward_list — erasing with a stored iterator

蹲街弑〆低调 提交于 2019-12-20 02:45:30
问题 I'm trying to keep a global list of a particular (base) class's instances so that I can track them down by iterating through this global list at any time. I believe the most proper way to address this is with an intrusive list. I have heard that one can encounter these creatures by digging into the Linux kernel, for example. In the situation where I'm in, I don't really need such guarantees of performance, and using intrusive lists will complicate matters somewhat for me. Here's what I've got

C++ CRTP and accessing derived's nested typedefs from base

一世执手 提交于 2019-12-13 11:36:17
问题 edit: I'll put a github link here when I am done altering my design for anyone who is interested. Background I'm replacing a boost::intrusive , intrusive_set , with my own implementation as 64-bit compiled intrusive-set stuffs 3 x 8-byte pointers into my container nodes. my container has a limit of 2^16 nodes so I can bring it down to 4-bytes per node with 2x 16-bit offset ordinals (which is a 6x reduction of size). In the example below base is the intrusive-set container. The derived class

Windows singly linked list (_SINGLE_LIST_ENTRY)

末鹿安然 提交于 2019-12-11 06:12:43
问题 I'm just doing some debugging on a Windows 7 crash dump, and I've come across a singly-linked list that I'm not able to fully understand. Here's the output from WinDBG: dt _GENERAL_LOOKASIDE_POOL fffff80002a14800 -b .... 0x000 SingleListHead: _SINGLE_LIST_ENTRY +0x000 Next: 0x0000000000220001 .... From what I've been reading, it seems that each singly linked list begins with a list head, which contains a pointer to the first element in the list, or null if the list is empty. Microsoft state:

Using BOOST_FOREACH with a constant intrusive list

我只是一个虾纸丫 提交于 2019-12-11 03:12:50
问题 Consider the following code to iterate over an intrusive list using the BOOST_FOREACH macro: #include <boost/foreach.hpp> #include <boost/intrusive/list.hpp> typedef boost::intrusive::list< boost::intrusive::list_base_hook<> > MyList; void iterate (const MyList& xs) { BOOST_FOREACH (MyList::const_reference node, xs); } int main () { MyList xs; iterate (xs); return 0; } Given boost version 1.48 the code fails with clang 3.2 (SVN) and gcc 4.6.3, but works with gcc 4.5.3. With non-const

Why isn't there boost::intrusive::map?

时光毁灭记忆、已成空白 提交于 2019-12-10 15:57:58
问题 The boost documentation (http://www.boost.org/doc/libs/1_55_0/doc/html/intrusive.html) states that the intrusive containers are implemented for list (both single/double linked), set and multiset . I couldn't find an implementation for the map. Is there any deeper reason for it, or is it just waiting to be implemented? 回答1: This is because a map<Key, Value> is actually set<std::pair<Key const, Value>> and Boost.Intrusive and Boost.MultiIndex sets allow you to use one of the value members as a

Boost.Intrusive and unordered_map

ぃ、小莉子 提交于 2019-12-04 11:05:57
问题 I am looking to use an intrusive unordered_map. For some reason there is only an unordered_set in the library. There is also an intrusive hashtable but I'm not sure it has the same functunality, also it doesn't have the same interface. Am I wrong and I missed the unordered_map link? If I am not is there a tutorial that will help me implement one? 回答1: It's an interesting question. Boost.Intrusive doesn't seem to provide any map interface, ordered or unordered. It has a lot of implementation

C++ CRTP and accessing derived's nested typedefs from base

左心房为你撑大大i 提交于 2019-12-03 01:51:28
edit: I'll put a github link here when I am done altering my design for anyone who is interested. Background I'm replacing a boost::intrusive , intrusive_set , with my own implementation as 64-bit compiled intrusive-set stuffs 3 x 8-byte pointers into my container nodes. my container has a limit of 2^16 nodes so I can bring it down to 4-bytes per node with 2x 16-bit offset ordinals (which is a 6x reduction of size). In the example below base is the intrusive-set container. The derived class has a std::vector<container_entry_type<entry_type> > . obviously with this level of indirection I need

Trying to learn boost::intrusive Q2

本小妞迷上赌 提交于 2019-12-01 14:11:23
if I uncomment these //BaseList baselist; //MemberList memberlist; outside the loop and comment out the ones inside the loop it crashes. I need to be able to have the baselist (and memberlist) outside any loop. How is this achieved? Edit The actual problem I am trying to solve in it's simplest form is this. I want to have a std::vector of MyClass , call it AllThingsBunchedTogether. I also want to have a std::vector of BaseList , call it AllThingsSpreadOut. So AllThingsBunchedTogether might contain (just the anInt1 part for the sake of compactness): 1,2,1,10,2,3,4,4,5,9,10,10 .

Trying to learn boost::intrusive Q2

倖福魔咒の 提交于 2019-12-01 13:21:43
问题 if I uncomment these //BaseList baselist; //MemberList memberlist; outside the loop and comment out the ones inside the loop it crashes. I need to be able to have the baselist (and memberlist) outside any loop. How is this achieved? Edit The actual problem I am trying to solve in it's simplest form is this. I want to have a std::vector of MyClass , call it AllThingsBunchedTogether. I also want to have a std::vector of BaseList , call it AllThingsSpreadOut. So AllThingsBunchedTogether might