|
Blender V5.3
|
#include <bmesh_polygon.hh>
Public Types | |
| using | value_type = T |
| using | pointer = T * |
| using | const_pointer = const T * |
| using | reference = T & |
| using | const_reference = const T & |
| using | iterator = T * |
| using | const_iterator = const T * |
| using | size_type = int64_t |
| using | allocator_type = Allocator |
Public Member Functions | |
| Vector (Allocator allocator={}) noexcept | |
| Vector (NoExceptConstructor, Allocator allocator={}) noexcept | |
| Vector (int64_t size, Allocator allocator={}) | |
| Vector (int64_t size, const T &value, Allocator allocator={}) | |
| template<typename U> requires (std::is_convertible_v<U, T>) | |
| Vector (Span< U > values, Allocator allocator={}) | |
| template<typename U> requires (std::is_convertible_v<U, T>) | |
| Vector (MutableSpan< U > values, Allocator allocator={}) | |
| template<typename U> requires (std::is_convertible_v<U, T>) | |
| Vector (const std::initializer_list< U > &values) | |
| Vector (const std::initializer_list< T > &values) | |
| template<typename U, size_t N> requires (std::is_convertible_v<U, T>) | |
| Vector (const std::array< U, N > &values) | |
| template<typename InputIt> requires (!std::is_convertible_v<InputIt, int>) | |
| Vector (InputIt first, InputIt last, Allocator allocator={}) | |
| Vector (const Vector &other) | |
| template<int64_t OtherInlineBufferCapacity> | |
| Vector (const Vector< T, OtherInlineBufferCapacity, Allocator > &other) | |
| template<int64_t OtherInlineBufferCapacity> | |
| Vector (Vector< T, OtherInlineBufferCapacity, Allocator > &&other) noexcept(is_nothrow_move_constructible()) | |
| Vector (const VectorData< T, Allocator > &data) | |
| ~Vector () | |
| Vector & | operator= (const Vector &other) |
| Vector & | operator= (Vector &&other) |
| const T & | operator[] (int64_t index) const |
| T & | operator[] (int64_t index) |
| operator Span< T > () const | |
| operator MutableSpan< T > () | |
| template<typename U> requires (is_span_convertible_pointer_v<T, U>) | |
| operator Span< U > () const | |
| template<typename U> requires (is_span_convertible_pointer_v<T, U>) | |
| operator MutableSpan< U > () | |
| Span< T > | as_span () const |
| MutableSpan< T > | as_mutable_span () |
| void | reserve (const int64_t min_capacity) |
| void | resize (const int64_t new_size) |
| void | resize (const int64_t new_size, const T &value) |
| void | reinitialize (const int64_t new_size) |
| void | clear () |
| void | clear_and_shrink () |
| void | append (const T &value) |
| void | append (T &&value) |
| template<typename... ForwardValue> | |
| void | append_as (ForwardValue &&...value) |
| int64_t | append_and_get_index (const T &value) |
| int64_t | append_and_get_index (T &&value) |
| template<typename... ForwardValue> | |
| int64_t | append_and_get_index_as (ForwardValue &&...value) |
| void | append_non_duplicates (const T &value) |
| void | append_unchecked (const T &value) |
| void | append_unchecked (T &&value) |
| template<typename... ForwardT> | |
| void | append_unchecked_as (ForwardT &&...value) |
| void | append_n_times (const T &value, const int64_t n) |
| void | increase_size_by_unchecked (const int64_t n) noexcept |
| void | extend (Span< T > array) |
| void | extend (const T *start, int64_t amount) |
| template<int64_t OtherInlineBufferCapacity> | |
| void | extend (Vector< T, OtherInlineBufferCapacity, Allocator > &&other) |
| void | extend_non_duplicates (Span< T > array) |
| void | extend_unchecked (Span< T > array) |
| void | extend_unchecked (const T *start, int64_t amount) |
| template<typename InputIt> | |
| void | extend (InputIt first, InputIt last) |
| void | insert (const int64_t insert_index, const T &value) |
| void | insert (const int64_t insert_index, T &&value) |
| void | insert (const int64_t insert_index, Span< T > array) |
| template<typename InputIt> | |
| void | insert (const T *insert_position, InputIt first, InputIt last) |
| template<typename InputIt> | |
| void | insert (const int64_t insert_index, InputIt first, InputIt last) |
| void | prepend (const T &value) |
| void | prepend (T &&value) |
| void | prepend (Span< T > values) |
| template<typename InputIt> | |
| void | prepend (InputIt first, InputIt last) |
| const T & | last (const int64_t n=0) const |
| T & | last (const int64_t n=0) |
| const T & | first () const |
| T & | first () |
| int64_t | size () const |
| bool | is_empty () const |
| void | remove_last () |
| T | pop_last () |
| void | remove_and_reorder (const int64_t index) |
| void | remove_first_occurrence_and_reorder (const T &value) |
| void | remove (const int64_t index) |
| void | remove (const int64_t start_index, const int64_t amount) |
| template<typename Predicate> | |
| int64_t | remove_if (Predicate &&predicate) |
| int64_t | first_index_of_try (const T &value) const |
| int64_t | first_index_of (const T &value) const |
| bool | contains (const T &value) const |
| void | fill (const T &value) const |
| T * | data () |
| const T * | data () const |
| T * | begin () |
| T * | end () |
| const T * | begin () const |
| const T * | end () const |
| std::reverse_iterator< T * > | rbegin () |
| std::reverse_iterator< T * > | rend () |
| std::reverse_iterator< const T * > | rbegin () const |
| std::reverse_iterator< const T * > | rend () const |
| int64_t | capacity () const |
| bool | is_at_capacity () const |
| IndexRange | index_range () const |
| uint64_t | hash () const |
| VectorData< T, Allocator > | release () |
| void | print_stats (const char *name) const |
| bool | is_inline () const |
Static Public Member Functions | |
| static uint64_t | hash_as (const Span< T > values) |
Friends | |
| template<typename OtherT, int64_t OtherInlineBufferCapacity, typename OtherAllocator> | |
| class | Vector |
| bool | operator== (const Vector &a, const Vector &b) |
| bool | operator!= (const Vector &a, const Vector &b) |
| T | Type of the values stored in this vector. It has to be movable. |
| InlineBufferCapacity | The number of values that can be stored in this vector, without doing a heap allocation. Sometimes it makes sense to increase this value a lot. The memory in the inline buffer is not initialized when it is not needed. |
When T is large, the small buffer optimization is disabled by default to avoid large unexpected allocations on the stack. It can still be enabled explicitly though.
| Allocator | The allocator used by this vector. Should rarely be changed, except when you don't want that MEM_* is used internally. |
Definition at line 76 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::allocator_type = Allocator |
Definition at line 86 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::const_iterator = const T * |
Definition at line 84 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::const_pointer = const T * |
Definition at line 80 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::const_reference = const T & |
Definition at line 82 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::iterator = T * |
Definition at line 83 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::pointer = T * |
Definition at line 79 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::reference = T & |
Definition at line 81 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::size_type = int64_t |
Definition at line 85 of file bmesh_polygon.hh.
| using blender::blender::Vector< T, InlineBufferCapacity, Allocator >::value_type = T |
Definition at line 78 of file bmesh_polygon.hh.
|
inlinenoexcept |
Create an empty vector. This does not do any memory allocation.
Definition at line 140 of file bmesh_polygon.hh.
|
inlinenoexcept |
Definition at line 148 of file bmesh_polygon.hh.
|
inlineexplicit |
Create a vector with a specific size. The elements will be default constructed. If T is trivially constructible, the elements in the vector are not touched.
Definition at line 155 of file bmesh_polygon.hh.
|
inline |
Create a vector filled with a specific value.
Definition at line 164 of file bmesh_polygon.hh.
|
inline |
Create a vector from a span. The values in the vector are copy constructed.
Definition at line 174 of file bmesh_polygon.hh.
|
inlineexplicit |
Definition at line 185 of file bmesh_polygon.hh.
|
inline |
Create a vector that contains copies of the values in the initialized list.
This allows you to write code like: Vector<int> vec = {3, 4, 5};
Definition at line 198 of file bmesh_polygon.hh.
|
inline |
Definition at line 204 of file bmesh_polygon.hh.
|
inline |
Definition at line 207 of file bmesh_polygon.hh.
|
inline |
Definition at line 214 of file bmesh_polygon.hh.
|
inline |
Create a copy of another vector. The other vector will not be changed. If the other vector has less than InlineBufferCapacity elements, no allocation will be made.
Definition at line 229 of file bmesh_polygon.hh.
|
inline |
Create a copy of a vector with a different InlineBufferCapacity. This needs to be handled separately, so that the other one is a valid copy constructor.
Definition at line 236 of file bmesh_polygon.hh.
|
inlinenoexcept |
Steal the elements from another vector. This does not do an allocation. The other vector will have zero elements afterwards.
Definition at line 246 of file bmesh_polygon.hh.
|
inline |
Initializes the Vector from an existing buffer. The Vector takes ownership of the buffer. The caller is responsible to make sure that the buffer has been allocated with the same allocator that the Vector will use to deallocate it.
Definition at line 314 of file bmesh_polygon.hh.
|
inline |
Definition at line 330 of file bmesh_polygon.hh.
|
inline |
Insert a new element at the end of the vector. This might cause a reallocation with the capacity is exceeded.
This is similar to std::vector::push_back.
Definition at line 498 of file bmesh_polygon.hh.
Referenced by blender::ui::but_event_property_operator_string(), blender::ui::button_section_bounds_calc(), blender::ui::colorspaces_menu_draw(), blender::ui::context_copy_to_selected_list(), blender::ui::context_fcurve_modifiers_via_fcurve(), blender::ui::context_path_add_generic(), blender::ui::context_selected_key_blocks(), blender::ui::curvemap_buttons_layout(), blender::ui::CurveProfile_buttons_layout(), blender::ui::draw_but_WAVEFORM(), blender::ui::internal::get_property_drivers(), blender::ui::label_markdown_create_link_buttons(), blender::ui::menu_items_from_all_operators(), blender::ui::Layout::prop(), blender::ui::region_panels_sort_for_search_filter_visibility_change(), blender::ui::reorder_instanced_panel_list(), blender::ui::rna_collection_search_update_fn(), blender::ed::object::shape_key_copy_exec(), blender::ui::text_clip_multiline_middle(), blender::ui::ui_context_matched_tree_interface_items(), blender::ui::uiAlignPanelStep(), blender::ui::update_flexible_spacing(), blender::ui::widget_draw_textbox(), and blender::ui::string_search::write_recent_searches_file().
|
inline |
Definition at line 502 of file bmesh_polygon.hh.
|
inline |
Append the value to the vector and return the index that can be used to access the newly added value.
Definition at line 517 of file bmesh_polygon.hh.
|
inline |
Definition at line 521 of file bmesh_polygon.hh.
|
inline |
Definition at line 525 of file bmesh_polygon.hh.
|
inline |
Definition at line 507 of file bmesh_polygon.hh.
|
inline |
Insert the same element n times at the end of the vector. This might result in a reallocation internally.
Definition at line 569 of file bmesh_polygon.hh.
|
inline |
Append the value if it is not yet in the vector. This has to do a linear search to check if the value is in the vector. Therefore, this should only be called when it is known that the vector is small.
Definition at line 537 of file bmesh_polygon.hh.
|
inline |
Append the value and assume that vector has enough memory reserved. This invokes undefined behavior when not enough capacity has been reserved beforehand. Only use this in performance critical code.
Definition at line 549 of file bmesh_polygon.hh.
|
inline |
Definition at line 553 of file bmesh_polygon.hh.
|
inline |
Definition at line 557 of file bmesh_polygon.hh.
|
inline |
Definition at line 395 of file bmesh_polygon.hh.
Referenced by blender::ui::block_align_calc().
|
inline |
Definition at line 390 of file bmesh_polygon.hh.
Referenced by blender::ui::copy_driver_to_selected_button(), and blender::ui::tests::TEST_F().
|
inline |
Definition at line 967 of file bmesh_polygon.hh.
Referenced by blender::ui::region_panels_sort_for_search_filter_visibility_change(), blender::ui::reorder_instanced_panel_list(), and blender::ui::uiAlignPanelStep().
|
inline |
Definition at line 976 of file bmesh_polygon.hh.
|
inline |
Get the current capacity of the vector, i.e. the maximum number of elements the vector can hold, before it has to reallocate.
Definition at line 1007 of file bmesh_polygon.hh.
|
inline |
Afterwards the vector has 0 elements, but will still have memory to be refilled again.
Definition at line 468 of file bmesh_polygon.hh.
Referenced by blender::ui::context_fcurve_modifiers_via_fcurve().
|
inline |
Afterwards the vector has 0 elements and any allocated memory will be freed.
Definition at line 479 of file bmesh_polygon.hh.
|
inline |
Do a linear search to see of the value is in the vector. Return true when it exists, otherwise false.
Definition at line 938 of file bmesh_polygon.hh.
|
inline |
Get access to the underlying array.
Definition at line 954 of file bmesh_polygon.hh.
Referenced by blender::ui::selectcontext_begin().
|
inline |
Get access to the underlying array.
Definition at line 962 of file bmesh_polygon.hh.
|
inline |
Definition at line 971 of file bmesh_polygon.hh.
Referenced by blender::ui::region_panels_sort_for_search_filter_visibility_change(), blender::ui::reorder_instanced_panel_list(), and blender::ui::uiAlignPanelStep().
|
inline |
Definition at line 980 of file bmesh_polygon.hh.
|
inline |
Definition at line 599 of file bmesh_polygon.hh.
|
inline |
Definition at line 650 of file bmesh_polygon.hh.
|
inline |
Copy the elements of another array to the end of this vector.
This can be used to emulate parts of std::vector::insert.
Definition at line 595 of file bmesh_polygon.hh.
|
inline |
Moves the elements of another vector to the end of this vector.
This may result in reallocation to fit other vector elements, other vector will keep it buffer allocation, but it will become empty. This can be used in vectors that manages resources, allowing acquiring resources from another vector, preventing shared ownership of managed resources.
Definition at line 614 of file bmesh_polygon.hh.
|
inline |
Adds all elements from the array that are not already in the vector. This is an expensive operation when the vector is large, but can be very cheap when it is known that the vector is small.
Definition at line 626 of file bmesh_polygon.hh.
|
inline |
Definition at line 641 of file bmesh_polygon.hh.
|
inline |
Extend the vector without bounds checking. It is assumed that enough memory has been reserved beforehand. Only use this in performance critical code.
Definition at line 637 of file bmesh_polygon.hh.
|
inline |
Copies the given value to every element in the vector.
Definition at line 946 of file bmesh_polygon.hh.
|
inline |
Definition at line 771 of file bmesh_polygon.hh.
|
inline |
Return a reference to the first element in the vector. This invokes undefined behavior when the vector is empty.
Definition at line 766 of file bmesh_polygon.hh.
Referenced by blender::ui::region_panels_sort_for_search_filter_visibility_change().
|
inline |
Do a linear search to find the value in the vector and return the found index. This invokes undefined behavior when the value is not in the vector.
Definition at line 927 of file bmesh_polygon.hh.
|
inline |
Do a linear search to find the value in the vector. When found, return the first index, otherwise return -1.
Definition at line 913 of file bmesh_polygon.hh.
|
inline |
Definition at line 1031 of file bmesh_polygon.hh.
|
inlinestatic |
Definition at line 1036 of file bmesh_polygon.hh.
|
inlinenoexcept |
Enlarges the size of the internal buffer that is considered to be initialized. This invokes undefined behavior when the new size is larger than the capacity. The method can be useful when you want to call constructors in the vector yourself. This should only be done in very rare cases and has to be justified every time.
Definition at line 583 of file bmesh_polygon.hh.
|
inline |
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]); }
Definition at line 1026 of file bmesh_polygon.hh.
Referenced by blender::ui::block_align_calc(), blender::ui::draw_warnings(), blender::ui::rna_collection_search_update_fn(), and blender::ui::uiAlignPanelStep().
|
inline |
Insert elements into the vector at the specified position. This has a running time of O(n) where n is the number of values that have to be moved. Undefined behavior is invoked when the insert position is out of bounds.
Definition at line 660 of file bmesh_polygon.hh.
|
inline |
Definition at line 678 of file bmesh_polygon.hh.
|
inline |
Definition at line 669 of file bmesh_polygon.hh.
|
inline |
Definition at line 664 of file bmesh_polygon.hh.
|
inline |
Definition at line 673 of file bmesh_polygon.hh.
|
inline |
Definition at line 1012 of file bmesh_polygon.hh.
|
inline |
Returns true when the vector contains no elements, otherwise false.
This is the same as std::vector::empty.
Definition at line 792 of file bmesh_polygon.hh.
Referenced by blender::ui::button_section_bounds_calc(), blender::ui::colorspaces_menu_draw(), blender::ui::context_copy_to_selected_list(), blender::ui::context_fcurve_modifiers_via_fcurve(), blender::ui::copy_driver_to_selected_button(), blender::ui::curvemap_buttons_layout(), blender::ui::CurveProfile_buttons_layout(), blender::ui::Layout::prop(), blender::ui::region_panels_sort_for_search_filter_visibility_change(), blender::ui::selectcontext_begin(), blender::ui::tooltip_data_from_button_or_extra_icon(), and blender::ui::uiAlignPanelStep().
|
inline |
Definition at line 1108 of file bmesh_polygon.hh.
|
inline |
Definition at line 755 of file bmesh_polygon.hh.
|
inline |
Return a reference to the nth last element. This invokes undefined behavior when the vector is too short.
Definition at line 749 of file bmesh_polygon.hh.
Referenced by blender::ui::button_section_bounds_calc().
|
inline |
Definition at line 371 of file bmesh_polygon.hh.
|
inline |
Definition at line 384 of file bmesh_polygon.hh.
|
inline |
Definition at line 366 of file bmesh_polygon.hh.
|
inline |
Definition at line 377 of file bmesh_polygon.hh.
|
inline |
Definition at line 338 of file bmesh_polygon.hh.
|
inline |
Definition at line 343 of file bmesh_polygon.hh.
|
inline |
Definition at line 359 of file bmesh_polygon.hh.
|
inline |
Get the value at the given index. This invokes undefined behavior when the index is out of bounds.
Definition at line 352 of file bmesh_polygon.hh.
|
inline |
Remove the last element from the vector and return it. This invokes undefined behavior when the vector is empty.
This is similar to std::vector::pop_back.
Definition at line 815 of file bmesh_polygon.hh.
Referenced by blender::ui::Layout::prop().
|
inline |
Insert values at the beginning of the vector. This has to move all the other elements, so it has a linear running time.
Definition at line 728 of file bmesh_polygon.hh.
|
inline |
Definition at line 740 of file bmesh_polygon.hh.
|
inline |
Definition at line 736 of file bmesh_polygon.hh.
|
inline |
Definition at line 732 of file bmesh_polygon.hh.
|
inline |
Print some debug information about the vector.
Definition at line 1102 of file bmesh_polygon.hh.
|
inline |
Definition at line 985 of file bmesh_polygon.hh.
|
inline |
Definition at line 994 of file bmesh_polygon.hh.
|
inline |
Reset the size of the vector so that it contains new_size elements. All existing elements are destructed, and not copied if the data must be reallocated.
Definition at line 458 of file bmesh_polygon.hh.
|
inline |
Release the underlying memory buffer from the Vector. The caller is responsible for freeing the pointer if it is non-null.
If the values were stored in the inline-buffer, the values are copied to a newly allocated array first. The caller does not have to any special handling in this case.
The Vector will be empty afterwards.
Definition at line 1060 of file bmesh_polygon.hh.
|
inline |
Remove the element at the given index and move all values coming after it one towards the front. This takes O(n) time. If the order is not important, remove_and_reorder should be used instead.
This is similar to std::vector::erase.
Definition at line 860 of file bmesh_polygon.hh.
|
inline |
Remove a contiguous chunk of elements and move all values coming after it towards the front. This takes O(n) time.
This is similar to std::vector::erase.
Definition at line 879 of file bmesh_polygon.hh.
|
inline |
Delete any element in the vector. The empty space will be filled by the previously last element. This takes O(1) time.
Definition at line 829 of file bmesh_polygon.hh.
|
inline |
Finds the first occurrence of the value, removes it and copies the last element to the hole in the vector. This takes O(n) time.
Definition at line 847 of file bmesh_polygon.hh.
|
inline |
Remove all values for which the given predicate is true and return the number of values removed.
This is similar to std::erase_if.
Definition at line 900 of file bmesh_polygon.hh.
Referenced by blender::ui::context_copy_to_selected_list(), and blender::ui::LayoutInternal::layout_remove_but().
|
inline |
Destructs the last element and decreases the size by one. This invokes undefined behavior when the vector is empty.
Definition at line 801 of file bmesh_polygon.hh.
|
inline |
Definition at line 989 of file bmesh_polygon.hh.
|
inline |
Definition at line 998 of file bmesh_polygon.hh.
|
inline |
Make sure that enough memory is allocated to hold min_capacity elements. This won't necessarily make an allocation when min_capacity is small. The actual size of the vector does not change.
Definition at line 405 of file bmesh_polygon.hh.
Referenced by blender::ui::Layout::prop(), and blender::ui::text_clip_multiline_middle().
|
inline |
Change the size of the vector so that it contains new_size elements. If new_size is smaller than the old size, the elements at the end of the vector are destructed. If new_size is larger than the old size, the new elements at the end are default constructed. If T is trivially constructible, the memory is not touched by this function.
Definition at line 418 of file bmesh_polygon.hh.
Referenced by blender::ui::block_align_calc(), and blender::ui::internal::get_property_drivers().
|
inline |
Change the size of the vector so that it contains new_size elements. If new_size is smaller than the old size, the elements at the end of the vector are destructed. If new_size is larger than the old size, the new elements will be copy constructed from the given value.
Definition at line 439 of file bmesh_polygon.hh.
|
inline |
Return how many values are currently stored in the vector.
Definition at line 780 of file bmesh_polygon.hh.
Referenced by blender::ui::block_align_calc(), blender::ui::but_event_property_operator_string(), blender::ui::CurveProfile_buttons_layout(), blender::ui::draw_but_WAVEFORM(), blender::ui::internal::get_property_drivers(), blender::ui::reorder_instanced_panel_list(), blender::ui::rna_collection_search_update_fn(), blender::ui::selectcontext_begin(), blender::ui::template_project_asset_libraries_tree(), blender::ui::tests::TEST_F(), and blender::ui::widget_draw_textbox().
|
friend |
Definition at line 1046 of file bmesh_polygon.hh.
|
friend |
Definition at line 1041 of file bmesh_polygon.hh.
|
friend |
Be a friend with other vector instantiations. This is necessary to implement some memory management logic.
Definition at line 122 of file bmesh_polygon.hh.