Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/util/util_vector.h')
-rw-r--r--intern/cycles/util/util_vector.h25
1 files changed, 12 insertions, 13 deletions
diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h
index 92c3f116c69..15a65be0ef0 100644
--- a/intern/cycles/util/util_vector.h
+++ b/intern/cycles/util/util_vector.h
@@ -19,7 +19,8 @@
/* Vector */
-#include <string.h>
+#include <cassert>
+#include <cstring>
#include <vector>
#include "util_aligned_malloc.h"
@@ -40,20 +41,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>() { }
@@ -63,7 +60,7 @@ public:
/* Range constructor. */
template <class InputIterator>
- vector (InputIterator first, InputIterator last)
+ vector(InputIterator first, InputIterator last)
: std::vector<value_type, allocator_type>(first, last) { }
/* Copy constructor. */
@@ -78,7 +75,8 @@ public:
#endif
}
- void free_memory(void) {
+ void free_memory(void)
+ {
std::vector<value_type, allocator_type>::resize(0);
shrink_to_fit();
}
@@ -190,6 +188,7 @@ public:
T& operator[](size_t i) const
{
+ assert(i < datasize);
return data[i];
}