Questions tagged [boost-intrusive]

Boost Intrusive is a library presenting some intrusive containers to the world of C++. Intrusive containers are special containers that offer better performance and exception safety guarantees than non-intrusive containers (like STL containers)

The main difference between intrusive containers and non-intrusive containers is that in C++ non-intrusive containers store copies of values passed by the user (an intrusive container stores the objects themselves).

The performance benefits of intrusive containers makes them ideal as a building block to efficiently construct complex containers like multi-index containers or to design high performance code like memory allocation algorithms.

While intrusive containers were and are widely used in C, they became more and more forgotten in C++ due to the presence of the standard containers which don't support intrusive techniques. Boost.Intrusive wants to push intrusive containers usage encapsulating the implementation in STL-like interfaces.

25 questions
11
votes
1 answer

Boost intrusive pointer

I'm a little confused about boost's intrusive pointer. The definition says: "Every new intrusive_ptr instance increments the reference count by using an unqualified call to the function intrusive_ptr_add_ref, passing it the pointer as an…
Benjamin Larsen
  • 560
  • 1
  • 7
  • 21
4
votes
1 answer

how to detach elements from a boost::intrusive set container

I am trying to detach elements from a boost::intrusive set and getting a assertion failure. when i delete the element after detaching it from the container. The class derives from set_base_hook. class fileXfer : public set_base_hook > 70 { I am…
Ravikumar Tulugu
  • 1,702
  • 2
  • 18
  • 40
2
votes
0 answers

What was the ISO C++ committee rationale to not accept intrusive pointers and containers to any current C++ standards?

It seems that every single high performance and low latency platform I work with use intrusive pointers and containers to manage the lifetime cycle of their objects. Game engines, trading systems, avionics and others. Intrusive pointers have been…
user8143588
2
votes
1 answer

Do Intrusive containers still have performance advantages over non-intrusive ones in modern C++?

Do Boost.Intrusive containers still have performance advantages over non-intrusive standard (std::) ones in the modern C++ (with move semantic, emplace_back, etc)?
Gluttton
  • 5,739
  • 3
  • 31
  • 58
2
votes
1 answer

C++ Boost Intrusive List - Example

I am curious about the boost intrusive containers and wanted to test it. I basically copy pasted the example from boost.org in the chapter "How to use Boost.Intrusive". So my Code looks like this: #include #include…
Zweistein
  • 293
  • 1
  • 4
  • 11
2
votes
2 answers

How to transfer nodes between two boost::intrusive::slist objects

Is it valid to transfer nodes between two boost::intrusive::slist> objects? Something like the following auto one = boost::intrusive::slist>{}; auto two =…
Curious
  • 20,870
  • 8
  • 61
  • 146
2
votes
1 answer

How to erase while iterating boost::intrusive::list

How can I erase elements from a boost::intrusive::list while iterating through it? The following code fails with an assertion failure https://wandbox.org/permlink/nzFshFSsaIrvBiTa #include #include #include…
Curious
  • 20,870
  • 8
  • 61
  • 146
2
votes
1 answer

Boost Intrusive unordered_set static member function returns wrong size type

Consider this code, which compiles successfully: #include using namespace boost::intrusive; typedef unordered_set_member_hook<> Hook; struct Item { Hook hook; }; typedef unordered_set
John Zwinck
  • 239,568
  • 38
  • 324
  • 436
1
vote
1 answer

Check for end-of-list in boost::intrusive::list without container?

I'm getting started with Boost.Intrusive, specifically interested in the doubly-linked list (boost::intrusive::list). This would be trivial to do in a "hand-rolled" linked list, but so far I can't find a Boost equivalent: Given a node that belongs…
jwd
  • 10,837
  • 3
  • 43
  • 67
1
vote
0 answers

Ideas on how to track boost::intrusive_ptr's

I use boost::intrusive_ptr a lot to keep instances of certain classes alive. At some point my program expects all boost::intrusive_ptrs to have been deleted, so that the under laying object is released. A problem that I seem to frequently run into…
Carlo Wood
  • 5,648
  • 2
  • 35
  • 47
1
vote
1 answer

How to create boost::intrusive::list from an already existing legacy list?

I have a legacy structure like this: struct LIST_ENTRY { LIST_ENTRY *Flink; LIST_ENTRY *Blink; }; LIST_ENTRY legacyListHead; And legacy code that works with a list like this. How to create boost::intrusive::list from it, so that I could,…
Igor Pugachev
  • 604
  • 1
  • 5
  • 14
1
vote
1 answer

Using vector for buckets in boost intrusive

How does one manage the buckets of boost::intrusive::unordered_set with std::vector? The following code gives me nightmares: #include #include #include namespace BI = boost::intrusive; struct…
1
vote
1 answer

How to use boost::intrusive_ptr with boost::intrusive::list?

I want to allocate an object exact one time and push it to few lists. How can I do this with boost::intrusive_ptr and boost::intrusive::list? Or should I use another container and reference counter?
1
vote
1 answer

Boost.Intrusive Containers - Elements with different size

In the Boost.Intrusive docs in the chapter "When to use?" https://www.boost.org/doc/libs/1_72_0/doc/html/intrusive/usage_when.html, it is stated that you can use intrusive containers containing objects of different or unknown size. #include…
Zweistein
  • 293
  • 1
  • 4
  • 11
1
vote
1 answer

Merge two boost intrusive sets in C++?

I have two boost intrusive sets which I need to merge it together. I have map_old.m_old_attributes boost intrusive set which I need to merge it to m_map_new_attributes boost intrusive set void DataTest::merge_set(DataMap& map_old) { // merge…
john
  • 11,311
  • 40
  • 131
  • 251
1
2