[Bf-blender-cvs] [17f12fc] master: Cycles: Allow using custom allocators for vector class
Sergey Sharybin
noreply at git.blender.org
Sat Jun 27 15:18:39 CEST 2015
Commit: 17f12fc71a294ed00a1dd88093ec7ac516e0c15a
Author: Sergey Sharybin
Date: Fri Jun 26 22:36:31 2015 +0200
Branches: master
https://developer.blender.org/rB17f12fc71a294ed00a1dd88093ec7ac516e0c15a
Cycles: Allow using custom allocators for vector class
===================================================================
M intern/cycles/util/util_vector.h
===================================================================
diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h
index 92c3f11..af7c69c 100644
--- a/intern/cycles/util/util_vector.h
+++ b/intern/cycles/util/util_vector.h
@@ -40,20 +40,16 @@ CCL_NAMESPACE_BEGIN
*
* - Have method to ensure capacity is re-set to 0.
*/
-template<typename value_type>
-class vector : public std::vector<value_type
+template<typename value_type,
#ifdef WITH_CYCLES_DEBUG
- , GuardedAllocator<value_type>
+ typename allocator_type = GuardedAllocator<value_type>
+#else
+ typename allocator_type = std::allocator<value_type>
#endif
- >
+ >
+class vector : public std::vector<value_type, allocator_type>
{
public:
-#ifdef WITH_CYCLES_DEBUG
- typedef GuardedAllocator<value_type> allocator_type;
-#else
- typedef std::allocator<value_type> allocator_type;
-#endif
-
/* Default constructor. */
explicit vector() : std::vector<value_type, allocator_type>() { }
@@ -78,7 +74,8 @@ public:
#endif
}
- void free_memory(void) {
+ void free_memory(void)
+ {
std::vector<value_type, allocator_type>::resize(0);
shrink_to_fit();
}
More information about the Bf-blender-cvs
mailing list