Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Fancy Bullets
  • The typed lists in C++ are based on std::vector. VectorList is , e.g. IntList is std::vector<Vector>vector<int>, IntList  VectorList is std::vector<int>vector<Vector>, the etc. The general list ValueList is also based on std::vector and is std::vector<Value>
  • The Value type is a union of all types that can be inserted in a list and can contain typed lists or ValueList..
  • In C++ it is possible to set the data contained in long typed lists directly to V-Ray memory without copying leveraging the power of C++11 move semantics.
  • Lists All lists (based on std::vector), the Value type and plugin property setters support both copy and move semantics.
  • For small data sizes (short lists up to several hundred elements) it is not beneficial to use move semantics as it has a small (a few bytes) dynamic memory allocation cost. But even if used, it will move the data will be moved only above a certain threshold.

 


Plugin property setters selectively move or copy data depending on the type and size of the lists:

Tabs Container
directionhorizontal
Tabs Page
titleC++
Code Block
languagecpp
VectorList vectors(500000); // A large list of vectors
// Fill in the list...

// This will set a copy of vectors inside V-Ray memory
GeomStaticMesh.set_vertices(vectors);

// But this will get the vertices data pointer and set it directly into V-Ray memory avoiding the expensive copy operation
GeomStaticMesh.set_vertices(std::move(vectors));

...


Or in a more complex example:

...