Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_vector.hh
| Show First 20 Lines • Show All 898 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_); | ||||
| } | } | ||||
| bool is_at_capacity() const | |||||
| { | |||||
| return end_ == capacity_end_; | |||||
| } | |||||
| /** | /** | ||||
| * Get an index range that makes looping over all indices more convenient and less error prone. | * 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. | * Obviously, this should only be used when you actually need the index in the loop. | ||||
| * | * | ||||
| * Example: | * Example: | ||||
| * for (int64_t i : myvector.index_range()) { | * for (int64_t i : myvector.index_range()) { | ||||
| * do_something(i, my_vector[i]); | * do_something(i, my_vector[i]); | ||||
| * } | * } | ||||
| ▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines | |||||