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

Deactivate PoolAllocator and use std::allocator instead.

There are serious bugs in the implementation that cause very strange
behaviour if it is used. Until I find the bug I will leave it
deactivated.

If you want to use it despite the bugs define the USE_DUNE_POOL macro.

[[Imported from SVN: r5670]]
parent 93e3b000
No related branches found
No related tags found
No related merge requests found
......@@ -233,6 +233,9 @@ namespace Dune
* This means that assuming that N objects fit into memory only every N-th
* request for an object will result in memory allocation.
*
* @warning This class currently falls back to std::allocator as the current
* implementation has serious and hard to find bugs.
*
* @warning It is not suitable
* for the use in standard containers as it cannot allocate
* arrays of arbitrary size
......@@ -242,6 +245,10 @@ namespace Dune
*/
template<class T, std::size_t s>
class PoolAllocator
#ifndef USE_DUNE_POOL
: public std::allocator<T>
{};
#else
{
//friend std::ostream& std::operator<<<>(std::ostream&,PoolAllocator<T,s>&);
......@@ -336,18 +343,24 @@ namespace Dune
/**
* @brief Convert a reference to a pointer.
*/
inline pointer address(reference x) const { return &x; }
inline pointer address(reference x) const {
return &x;
}
/**
* @brief Convert a reference to a pointer.
*/
inline const_pointer address(const_reference x) const { return &x; }
inline const_pointer address(const_reference x) const {
return &x;
}
/**
* @brief Not correctly implemented, yet!
*/
inline int max_size() const throw(){ return 1;}
inline int max_size() const throw(){
return 1;
}
/**
* @brief Rebind the allocator to another type.
......@@ -452,6 +465,7 @@ namespace Dune
{
return false;
}
#endif
template<class T, std::size_t S>
inline Pool<T,S>::Pool()
......@@ -543,6 +557,8 @@ namespace Dune
return reinterpret_cast<T*>(p);
}
#ifdef USE_DUNE_POOL
template<class T, std::size_t s>
typename PoolAllocator<T,s>::PoolType PoolAllocator<T,s>::memoryPool_;
......@@ -575,7 +591,7 @@ namespace Dune
{
p->~T();
}
#endif
/** @} */
}
#endif
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