Skip to content
Snippets Groups Projects
Commit 4aa3ff86 authored by Markus Blatt's avatar Markus Blatt
Browse files

sync with my version.

[[Imported from SVN: r5743]]
parent d4290852
No related branches found
No related tags found
No related merge requests found
......@@ -210,10 +210,11 @@ namespace Dune
*/
MemberType item_;
Element(const MemberType& item);
Element(const MemberType& item, Element* next_=0);
Element();
~Element();
};
/**
......@@ -563,8 +564,8 @@ namespace Dune
{
template<typename T, class A>
SLList<T,A>::Element::Element(const T& item)
: next_(0), item_(item)
SLList<T,A>::Element::Element(const T& item, Element* next)
: next_(next), item_(item)
{}
template<typename T, class A>
......@@ -572,6 +573,12 @@ namespace Dune
: next_(0), item_()
{}
template<typename T, class A>
SLList<T,A>::Element::~Element()
{
next_=0;
}
template<typename T, class A>
SLList<T,A>::SLList()
: beforeHead_(), tail_(&beforeHead_), allocator_(), size_(0)
......@@ -678,10 +685,9 @@ namespace Dune
current->next_ = allocator_.allocate(1, 0);
// Use copy constructor to initialize memory
::new(static_cast<void*>(&(current->next_->item_)))T(item);
allocator_.construct(current->next_, Element(item,tmp));
// Set next element
current->next_->next_=tmp;
//::new(static_cast<void*>(&(current->next_->item_))) T(item);
if(!current->next_->next_) {
// Update tail
......@@ -731,8 +737,7 @@ namespace Dune
}
current->next_ = next->next_;
next->item_.~T();
next->next_ = 0;
allocator_.destroy(next);
allocator_.deallocate(next, 1);
--size_;
assert(!watchForTail || &beforeHead_ != tail_ || size_==0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment