From cc748e9168b6516683bdd8a08930d36d698db4eb Mon Sep 17 00:00:00 2001 From: Markus Blatt <mblatt@dune-project.org> Date: Mon, 26 Oct 2009 15:31:25 +0000 Subject: [PATCH] Reverting patch 5670. Inheritence breaks the rebind TMP of the allocator as it returns std::alloc now which cannot be converted to PoolAllocator. [[Imported from SVN: r5671]] --- dune/common/poolallocator.hh | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/dune/common/poolallocator.hh b/dune/common/poolallocator.hh index 14932c01e..a9e91bd15 100644 --- a/dune/common/poolallocator.hh +++ b/dune/common/poolallocator.hh @@ -233,9 +233,6 @@ 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 @@ -245,10 +242,6 @@ 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>&); @@ -343,24 +336,18 @@ 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. @@ -465,7 +452,6 @@ namespace Dune { return false; } -#endif template<class T, std::size_t S> inline Pool<T,S>::Pool() @@ -557,8 +543,6 @@ 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_; @@ -591,7 +575,7 @@ namespace Dune { p->~T(); } -#endif + /** @} */ } #endif -- GitLab