Blender  V3.3
cycles/util/vector.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifndef __UTIL_VECTOR_H__
5 #define __UTIL_VECTOR_H__
6 
7 #include <cassert>
8 #include <cstring>
9 #include <vector>
10 
11 #include "util/aligned_malloc.h"
12 #include "util/guarded_allocator.h"
13 
15 
16 /* Own subclass-ed version of std::vector. Subclass is needed because:
17  *
18  * - Use own allocator which keeps track of used/peak memory.
19  * - Have method to ensure capacity is re-set to 0.
20  */
21 template<typename value_type, typename allocator_type = GuardedAllocator<value_type>>
22 class vector : public std::vector<value_type, allocator_type> {
23  public:
24  typedef std::vector<value_type, allocator_type> BaseClass;
25 
26  /* Inherit all constructors from base class. */
27  using BaseClass::vector;
28 
29  /* Try as hard as possible to use zero memory. */
30  void free_memory()
31  {
33  BaseClass::swap(empty);
34  }
35 
36  /* Some external API might demand working with std::vector. */
37  operator std::vector<value_type>()
38  {
39  return std::vector<value_type>(this->begin(), this->end());
40  }
41 };
42 
44 
45 #endif /* __UTIL_VECTOR_H__ */
void swap(T &a, T &b)
Definition: Common.h:19
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a vector
std::vector< value_type, allocator_type > BaseClass
void free_memory()
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9