allocator.hh

00001 #ifndef DUNE_ALLOCATOR_HH
00002 #define DUNE_ALLOCATOR_HH
00003 
00004 #include <cstddef>
00005 #include <cstdlib>
00006 
00007 
00008 namespace Dune {
00009    
00027   class ISTLAllocator { // uses new and delete
00028   public:
00030     typedef int size_type;
00031     
00033     typedef std::ptrdiff_t difference_type;
00034     
00036         template<class T>
00037     static T* malloc (std::size_t nmemb)
00038         {
00039           T* p = new T[nmemb];
00040           return p;
00041         }
00042 
00044         template<class T>
00045     static void free (T* p)
00046         {
00047           delete [] p;
00048         }
00049   };
00050 
00053 } // end namespace
00054 
00055 #endif

Generated on 9 Apr 2008 with Doxygen (ver 1.5.2) [logfile].