mirror of
https://github.com/boostorg/log.git
synced 2026-02-11 11:52:20 +00:00
Fixed incorrect element insertion.
The inserted attributes and attribute values could sometimes be left not-findable by find() method and other methods that rely on it. The elements were still obtainable through iteration.
This commit is contained in:
@@ -391,27 +391,34 @@ private:
|
||||
p = new node(key, data, true);
|
||||
}
|
||||
|
||||
node_list::iterator it;
|
||||
if (b.first == NULL)
|
||||
{
|
||||
// The bucket is empty
|
||||
b.first = b.last = p;
|
||||
m_Nodes.push_back(*p);
|
||||
it = m_Nodes.end();
|
||||
}
|
||||
else if (where == b.first)
|
||||
{
|
||||
// The new element should become the first element of the bucket
|
||||
it = m_Nodes.iterator_to(*where);
|
||||
b.first = p;
|
||||
}
|
||||
else if (where == b.last && key.id() > where->m_Value.first.id())
|
||||
{
|
||||
// The new element should become the last element of the bucket
|
||||
node_list::iterator it = m_Nodes.iterator_to(*where);
|
||||
it = m_Nodes.iterator_to(*where);
|
||||
++it;
|
||||
m_Nodes.insert(it, *p);
|
||||
b.last = p;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The new element should be within the bucket
|
||||
node_list::iterator it = m_Nodes.iterator_to(*where);
|
||||
m_Nodes.insert(it, *p);
|
||||
it = m_Nodes.iterator_to(*where);
|
||||
}
|
||||
|
||||
m_Nodes.insert(it, *p);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user