mirror of
https://github.com/boostorg/container.git
synced 2026-01-19 04:02:17 +00:00
Fix class invariant comment. In this implementation default constructed deque make no allocation so in that case start and finish are singular iterators.
This commit is contained in:
@@ -481,7 +481,7 @@ inserted predominantly on one extreme (e.g. pushed at one extreme and popped fro
|
||||
To avoid unbounded memory waste, Boost.Container's `devector` uses a different strategy:
|
||||
|
||||
* If elements are inserted near a extreme and there is free space on that extreme, the insertion is performed
|
||||
without any additional data movement (only the elements between the insertion point and the extreme are moved.
|
||||
without any additional data movement (only the elements between the insertion point and the extreme are moved).
|
||||
|
||||
* If elements are inserted near one extreme and the free space on that extreme is exhausted, all existing elements
|
||||
are relocated (moved) to the center of the internal memory buffer. This makes room in the exhausted extreme
|
||||
@@ -492,7 +492,7 @@ To avoid unbounded memory waste, Boost.Container's `devector` uses a different s
|
||||
relocations must be limited ('relocation limit') and a reallocation (allocation of a new memory buffer) will be
|
||||
performed if the load-factor of the container defined as (size()/length_of_buffer) surpasses the relocation limit (see
|
||||
Lars Greger Nordland Hagen's [@http://larshagencpp.github.io/blog/2016/05/22/devector "Double-ended vector - is it useful?"]
|
||||
article for more details.
|
||||
article for more details).
|
||||
|
||||
* This approach offers a reasonable balance between a reasonable memory overhead and performance.
|
||||
|
||||
|
||||
@@ -91,9 +91,6 @@ namespace dtl {
|
||||
// i.cur is a pointer in the range [i.first, i.last). NOTE:
|
||||
// the implication of this is that i.cur is always a dereferenceable
|
||||
// pointer, even if i is a past-the-end iterator.
|
||||
// Start and Finish are always nonsingular iterators. NOTE: this means
|
||||
// that an empty deque must have one node, and that a deque
|
||||
// with N elements, where N is the buffer size, must have two nodes.
|
||||
// For every node other than start.node and finish.node, every element
|
||||
// in the node is an initialized object. If start.node == finish.node,
|
||||
// then [start.cur, finish.cur) are initialized objects, and
|
||||
@@ -255,8 +252,7 @@ class deque_iterator
|
||||
offset > 0 ? (offset / block_size)
|
||||
: (-difference_type((-offset - 1) / block_size) - 1);
|
||||
this->priv_set_node(this->m_node + node_offset, size_type(block_size));
|
||||
this->m_cur = this->m_first +
|
||||
(offset - node_offset * block_size);
|
||||
this->m_cur = this->m_first + (offset - node_offset * block_size);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user