Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/util/util_vector.h
| Show All 18 Lines | |||||
| /* Vector */ | /* Vector */ | ||||
| #include <cassert> | #include <cassert> | ||||
| #include <cstring> | #include <cstring> | ||||
| #include <vector> | #include <vector> | ||||
| #include "util_aligned_malloc.h" | #include "util_aligned_malloc.h" | ||||
| #include "util_types.h" | |||||
| #ifdef WITH_CYCLES_DEBUG | |||||
| # include "util_guarded_allocator.h" | #include "util_guarded_allocator.h" | ||||
| #endif | #include "util_types.h" | ||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| /* Vector | /* Vector | ||||
| * | * | ||||
| * Own subclass-ed vestion of std::vector. Subclass is needed because: | * Own subclass-ed vestion of std::vector. Subclass is needed because: | ||||
| * | * | ||||
| * - When building with WITH_CYCLES_DEBUG we need to use own allocator which | * - Use own allocator which keeps track of used/peak memory. | ||||
| * keeps track of used/peak memory. | |||||
| * | * | ||||
| * - Have method to ensure capacity is re-set to 0. | * - Have method to ensure capacity is re-set to 0. | ||||
| */ | */ | ||||
| template<typename value_type, | template<typename value_type, | ||||
| #ifdef WITH_CYCLES_DEBUG | typename allocator_type = 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> | class vector : public std::vector<value_type, allocator_type> | ||||
| { | { | ||||
| public: | public: | ||||
| /* Default constructor. */ | /* Default constructor. */ | ||||
| explicit vector() : std::vector<value_type, allocator_type>() { } | explicit vector() : std::vector<value_type, allocator_type>() { } | ||||
| /* Fill constructor. */ | /* Fill constructor. */ | ||||
| explicit vector(size_t n, const value_type& val = value_type()) | explicit vector(size_t n, const value_type& val = value_type()) | ||||
| ▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines | |||||