NodeProxy create() template member replaced by template function.

[SVN r80774]
This commit is contained in:
Adam Wulkiewicz
2012-09-30 11:40:09 +00:00
parent 75959b7426
commit eb7ba34800
6 changed files with 37 additions and 23 deletions

View File

@@ -57,18 +57,6 @@ public:
, m_allocators(allocator)
{}
template <typename Node>
node * create()
{
return detail::rtree::create_node<allocators_type, Node>::apply(m_allocators);
}
template <typename Node>
void destroy(node * n)
{
return detail::rtree::destroy_node<allocators_type, Node>::apply(m_allocators, n);
}
// HMMMM - trzeba zwracac uwage na translator::return_type
// template <typename Element>
// typename element_indexable_type<Element>::type const&
@@ -120,7 +108,12 @@ public:
return m_translator;
}
allocator_type allocator() const
allocators_type & allocators()
{
return m_allocators;
}
allocator_type & allocator()
{
return m_allocators.allocator;
}
@@ -131,6 +124,27 @@ private:
allocators_type m_allocators;
};
template <typename Node, typename Value, typename Parameters, typename Translator, typename Allocator>
typename node_proxy<Value, Parameters, Translator, Allocator>::node *
create(node_proxy<Value, Parameters, Translator, Allocator> & np)
{
return detail::rtree::create_node<
typename node_proxy<Value, Parameters, Translator, Allocator>::allocators_type,
Node
>::apply(np.allocators());
}
template <typename Node, typename Value, typename Parameters, typename Translator, typename Allocator>
void destroy(
typename node_proxy<Value, Parameters, Translator, Allocator>::node * n,
node_proxy<Value, Parameters, Translator, Allocator> & np)
{
return detail::rtree::destroy_node<
typename node_proxy<Value, Parameters, Translator, Allocator>::allocators_type,
Node
>::apply(np.allocators(), n);
}
}}}}} // namespace boost::geometry::index::detail::rtree
#endif // BOOST_GEOMETRY_EXTENSIONS_INDEX_RTREE_NODE_PROXY_HPP

View File

@@ -588,7 +588,7 @@ private:
{
assert(0 == m_root);
m_root = m_node_proxy.template create_node<leaf>();
m_root = detail::rtree::create<leaf>(m_node_proxy);
m_values_count = 0;
m_leafs_level = 0;
}

View File

@@ -41,7 +41,7 @@ public:
inline void operator()(internal_node & n)
{
node * new_node = m_node_proxy.template create<internal_node>();
node * new_node = rtree::create<internal_node>(m_node_proxy);
typedef typename rtree::elements_type<internal_node>::type elements_type;
elements_type & elements = rtree::elements(n);
@@ -61,7 +61,7 @@ public:
inline void operator()(leaf & l)
{
node * new_node = m_node_proxy.template create<leaf>();
node * new_node = rtree::create<leaf>(m_node_proxy);
typedef typename rtree::elements_type<leaf>::type elements_type;
elements_type & elements = rtree::elements(l);

View File

@@ -55,14 +55,14 @@ public:
rtree::apply_visitor(*this, *m_current_node);
}
m_node_proxy.template destroy<internal_node>(node_to_destroy);
rtree::destroy<internal_node>(node_to_destroy, m_node_proxy);
}
inline void operator()(leaf & l)
{
BOOST_GEOMETRY_INDEX_ASSERT(&l == rtree::get<leaf>(m_current_node), "invalid pointers");
m_node_proxy.template destroy<leaf>(m_current_node);
rtree::destroy<leaf>(m_current_node, m_node_proxy);
}
private:

View File

@@ -130,7 +130,7 @@ public:
NodeProxy & node_proxy)
{
// create additional node
node * second_node = node_proxy.template create<Node>();
node * second_node = rtree::create<Node>(node_proxy);
Node & n2 = rtree::get<Node>(*second_node);
// redistribute elements
@@ -287,7 +287,7 @@ protected:
BOOST_GEOMETRY_INDEX_ASSERT(&n == rtree::get<Node>(m_root_node), "node should be the root");
// create new root and add nodes
node * new_root = m_node_proxy.template create<internal_node>();
node * new_root = rtree::create<internal_node>(m_node_proxy);
rtree::elements(rtree::get<internal_node>(*new_root)).push_back(std::make_pair(n_box, m_root_node));
rtree::elements(rtree::get<internal_node>(*new_root)).push_back(additional_nodes[0]);

View File

@@ -128,13 +128,13 @@ public:
{
reinsert_elements(rtree::get<leaf>(*it->second), it->first);
m_node_proxy.template destroy<leaf>(it->second);
index::detail::rtree::destroy<leaf>(it->second, m_node_proxy);
}
else
{
reinsert_elements(rtree::get<internal_node>(*it->second), it->first);
m_node_proxy.template destroy<internal_node>(it->second);
rtree::destroy<internal_node>(it->second, m_node_proxy);
}
}
@@ -145,7 +145,7 @@ public:
m_root_node = rtree::elements(n)[0].second;
--m_leafs_level;
m_node_proxy.template destroy<internal_node>(root_to_destroy);
rtree::destroy<internal_node>(root_to_destroy, m_node_proxy);
}
}
}