Merged from index_dev

Fixed rtree::clear() mem leak.
Added test for clear() and boost::shared_ptr as Values.
Each linear algo test file divided into 2 files.
Added reference in docs->rtree introduction.

[SVN r81778]
This commit is contained in:
Adam Wulkiewicz
2012-12-07 22:52:53 +00:00
parent 640ae6ced6
commit f4f0094c3a
39 changed files with 496 additions and 43 deletions

View File

@@ -23,12 +23,12 @@ public:
typedef Container container_type;
inline explicit insert_iterator(Container & c)
: container(c)
: container(&c)
{}
insert_iterator & operator=(typename Container::value_type const& value)
{
container.insert(value);
container->insert(value);
return *this;
}
@@ -48,7 +48,7 @@ public:
}
private:
Container & container;
Container * container;
};
template <typename Container>

View File

@@ -146,7 +146,7 @@ public:
}
catch(...)
{
this->raw_destroy(*this, true);
this->raw_destroy(*this);
throw;
}
}
@@ -176,7 +176,7 @@ public:
}
catch(...)
{
this->raw_destroy(*this, true);
this->raw_destroy(*this);
throw;
}
}
@@ -188,7 +188,7 @@ public:
*/
inline ~rtree()
{
this->raw_destroy(*this, true);
this->raw_destroy(*this);
}
/*!
@@ -586,7 +586,7 @@ public:
*/
inline void clear()
{
this->raw_destroy(*this, false);
this->raw_destroy(*this);
}
/*!
@@ -775,19 +775,12 @@ private:
\param t The container which is going to be destroyed.
*/
inline void raw_destroy(rtree & t, bool destroy_root = true)
inline void raw_destroy(rtree & t)
{
if ( t.m_root )
{
if ( destroy_root )
{
detail::rtree::visitors::destroy<value_type, options_type, translator_type, box_type, allocators_type> del_v(t.m_root, t.m_allocators);
detail::rtree::apply_visitor(del_v, *t.m_root);
}
else
{
detail::rtree::clear_node<value_type, options_type, translator_type, box_type, allocators_type>::apply(*t.m_root, t.m_allocators);
}
detail::rtree::visitors::destroy<value_type, options_type, translator_type, box_type, allocators_type> del_v(t.m_root, t.m_allocators);
detail::rtree::apply_visitor(del_v, *t.m_root);
t.m_root = 0;
}