pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r3926 - trunk/pingus/src


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3926 - trunk/pingus/src
Date: Mon, 28 Jul 2008 16:26:16 +0200

Author: grumbel
Date: 2008-07-28 16:26:15 +0200 (Mon, 28 Jul 2008)
New Revision: 3926

Modified:
   trunk/pingus/src/memory_pool.hpp
Log:
Fixed return type issue

Modified: trunk/pingus/src/memory_pool.hpp
===================================================================
--- trunk/pingus/src/memory_pool.hpp    2008-07-28 14:25:56 UTC (rev 3925)
+++ trunk/pingus/src/memory_pool.hpp    2008-07-28 14:26:15 UTC (rev 3926)
@@ -20,6 +20,9 @@
 #include <assert.h>
 #include <vector>
 
+/** MemoryPool allows the allocation of small objects on a previous
+    allocated chunk of memeroy, thus reducing the amount of new/delete
+    calls that have do be done and providing a speed up. */
 template<class T>
 class MemoryPool
 {
@@ -79,15 +82,15 @@
   }
 
   template<class C> 
-  C* create() { return keep(new (allocate(sizeof(C))) C()); }
+  T* create() { return keep(new (allocate(sizeof(C))) C()); }
   template<class C, class Arg1>
-  C* create(const Arg1& arg1) { return keep(new (allocate(sizeof(C))) 
C(arg1)); }
+  T* create(const Arg1& arg1) { return keep(new (allocate(sizeof(C))) 
C(arg1)); }
   template<class C, class Arg1, class Arg2> 
-  C* create(const Arg1& arg1, const Arg2& arg2) { return keep(new 
(allocate(sizeof(C))) C(arg1, arg2)); }
+  T* create(const Arg1& arg1, const Arg2& arg2) { return keep(new 
(allocate(sizeof(C))) C(arg1, arg2)); }
   template<class C, class Arg1, class Arg2, class Arg3> 
-  C* create(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) { return 
keep(new (allocate(sizeof(C))) C(arg1, arg2, arg3)); }
+  T* create(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) { return 
keep(new (allocate(sizeof(C))) C(arg1, arg2, arg3)); }
   template<class C, class Arg1, class Arg2, class Arg3, class Arg4> 
-  C* create(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& 
arg4) { return keep(new (allocate(sizeof(C))) C(arg1, arg2, arg3, arg4)); }
+  T* create(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& 
arg4) { return keep(new (allocate(sizeof(C))) C(arg1, arg2, arg3, arg4)); }
 
 private:
   MemoryPool (const MemoryPool&);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]