mirror of
https://github.com/boostorg/intrusive.git
synced 2025-08-02 14:04:36 +02:00
Fix outdated limitations in std containers.
This commit is contained in:
@@ -144,9 +144,11 @@ A non-intrusive container has some limitations:
|
|||||||
a size overhead for each allocation to store bookkeeping information and a
|
a size overhead for each allocation to store bookkeeping information and a
|
||||||
synchronization to protected concurrent allocation from different threads.
|
synchronization to protected concurrent allocation from different threads.
|
||||||
|
|
||||||
* Only copies of objects are stored in non-intrusive containers. Hence copy
|
* Before C++11, only copies of objects could be stored in non-intrusive containers. Still
|
||||||
or move constructors and copy or move assignment operators are required. Non-copyable
|
copy or move constructors and copy or move assignment operators are required
|
||||||
and non-movable objects can't be stored in non-intrusive containers.
|
and non-copyable and non-movable objects can't be stored in some containers. In any case,
|
||||||
|
[*new] objects have to be created inside the container using constructors and the same
|
||||||
|
object can't be shared between two containers.
|
||||||
|
|
||||||
* It's not possible to store a derived object in a STL-container while
|
* It's not possible to store a derived object in a STL-container while
|
||||||
retaining its original type.
|
retaining its original type.
|
||||||
@@ -156,6 +158,9 @@ Intrusive containers have some important advantages:
|
|||||||
* Operating with intrusive containers doesn't invoke any memory management at all.
|
* Operating with intrusive containers doesn't invoke any memory management at all.
|
||||||
The time and size overhead associated with dynamic memory can be minimized.
|
The time and size overhead associated with dynamic memory can be minimized.
|
||||||
|
|
||||||
|
* The same object can be inserted in more than one container at the same time with
|
||||||
|
a tiny overhead in the object size.
|
||||||
|
|
||||||
* Iterating an Intrusive container needs less memory accesses than the semantically
|
* Iterating an Intrusive container needs less memory accesses than the semantically
|
||||||
equivalent container of pointers: iteration is faster.
|
equivalent container of pointers: iteration is faster.
|
||||||
|
|
||||||
@@ -208,7 +213,7 @@ Intrusive containers have also downsides:
|
|||||||
[[Memory management] [External] [Internal through allocator]]
|
[[Memory management] [External] [Internal through allocator]]
|
||||||
[[Insertion/Erasure time] [Faster] [Slower]]
|
[[Insertion/Erasure time] [Faster] [Slower]]
|
||||||
[[Memory locality] [Better] [Worse]]
|
[[Memory locality] [Better] [Worse]]
|
||||||
[[Can hold non-copyable and non-movable objects by value] [Yes] [No]]
|
[[Can insert the same object in more than one container] [Yes] [No]]
|
||||||
[[Exception guarantees] [Better] [Worse]]
|
[[Exception guarantees] [Better] [Worse]]
|
||||||
[[Computation of iterator from value] [Constant] [Non-constant]]
|
[[Computation of iterator from value] [Constant] [Non-constant]]
|
||||||
[[Insertion/erasure predictability] [High] [Low]]
|
[[Insertion/erasure predictability] [High] [Low]]
|
||||||
|
Reference in New Issue
Block a user