diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-26 23:36:31 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-27 16:13:08 +0300 |
commit | 17f12fc71a294ed00a1dd88093ec7ac516e0c15a (patch) | |
tree | c342e7fd2e1cfa3be8fc92075c128bbddb5a30f6 | |
parent | 9260c0c2baf6ec8c03e10a895301fba0f9adfcb3 (diff) |
Cycles: Allow using custom allocators for vector class
-rw-r--r-- | intern/cycles/util/util_vector.h | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h index 92c3f116c69..af7c69c7df9 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(); } |