Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_vector.hh
| Show First 20 Lines • Show All 869 Lines • ▼ Show 20 Lines | public: | ||||
| * Get the current capacity of the vector, i.e. the maximum number of elements the vector can | * Get the current capacity of the vector, i.e. the maximum number of elements the vector can | ||||
| * hold, before it has to reallocate. | * hold, before it has to reallocate. | ||||
| */ | */ | ||||
| int64_t capacity() const | int64_t capacity() const | ||||
| { | { | ||||
| return static_cast<int64_t>(capacity_end_ - begin_); | return static_cast<int64_t>(capacity_end_ - begin_); | ||||
| } | } | ||||
| /** | |||||
| * Get an index range that makes looping over all indices more convenient and less error prone. | |||||
| * Obviously, this should only be used when you actually need the index in the loop. | |||||
| * | |||||
| * Example: | |||||
| * for (int64_t i : myvector.index_range()) { | |||||
| * do_something(i, my_vector[i]); | |||||
| * } | |||||
| */ | |||||
| IndexRange index_range() const | |||||
| { | |||||
| return IndexRange(this->size()); | |||||
| } | |||||
| friend bool operator==(const Vector &a, const Vector &b) | friend bool operator==(const Vector &a, const Vector &b) | ||||
| { | { | ||||
| return a.as_span() == b.as_span(); | return a.as_span() == b.as_span(); | ||||
| } | } | ||||
| friend bool operator!=(const Vector &a, const Vector &b) | friend bool operator!=(const Vector &a, const Vector &b) | ||||
| { | { | ||||
| return !(a == b); | return !(a == b); | ||||
| ▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines | |||||