|
Blender
V2.93
|
#include <BLI_vector.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 |
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 , typename std::enable_if_t< std::is_convertible_v< U, T >> * = nullptr> | |
| Vector (Span< U > values, Allocator allocator={}) | |
| template<typename U , typename std::enable_if_t< std::is_convertible_v< U, T >> * = nullptr> | |
| Vector (const std::initializer_list< U > &values) | |
| Vector (const std::initializer_list< T > &values) | |
| template<typename U , size_t N, typename std::enable_if_t< std::is_convertible_v< U, T >> * = nullptr> | |
| Vector (const std::array< U, N > &values) | |
| template<typename InputIt , typename std::enable_if_t<!std::is_convertible_v< InputIt, int >> * = nullptr> | |
| Vector (InputIt first, InputIt last, Allocator allocator={}) | |
| Vector (ListBase &values, 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(std::is_nothrow_move_constructible_v< T >) | |
| ~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 , typename std::enable_if_t< is_span_convertible_pointer_v< T, U >> * = nullptr> | |
| operator Span< U > () const | |
| template<typename U , typename std::enable_if_t< is_span_convertible_pointer_v< T, U >> * = nullptr> | |
| 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 | clear () |
| void | clear_and_make_inline () |
| void | append (const T &value) |
| void | append (T &&value) |
| int64_t | append_and_get_index (const T &value) |
| void | append_non_duplicates (const T &value) |
| template<typename ForwardT > | |
| void | append_unchecked (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) |
| 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 |
| T & | last () |
| 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) |
| 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 |
| IndexRange | index_range () const |
| void | print_stats (StringRef name="") const |
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) |
Definition at line 78 of file BLI_vector.hh.
| using blender::Vector< T, InlineBufferCapacity, Allocator >::const_iterator = const T * |
Definition at line 86 of file BLI_vector.hh.
| using blender::Vector< T, InlineBufferCapacity, Allocator >::const_pointer = const T * |
Definition at line 82 of file BLI_vector.hh.
| using blender::Vector< T, InlineBufferCapacity, Allocator >::const_reference = const T & |
Definition at line 84 of file BLI_vector.hh.
| using blender::Vector< T, InlineBufferCapacity, Allocator >::iterator = T * |
Definition at line 85 of file BLI_vector.hh.
| using blender::Vector< T, InlineBufferCapacity, Allocator >::pointer = T * |
Definition at line 81 of file BLI_vector.hh.
| using blender::Vector< T, InlineBufferCapacity, Allocator >::reference = T & |
Definition at line 83 of file BLI_vector.hh.
| using blender::Vector< T, InlineBufferCapacity, Allocator >::size_type = int64_t |
Definition at line 87 of file BLI_vector.hh.
| using blender::Vector< T, InlineBufferCapacity, Allocator >::value_type = T |
Definition at line 80 of file BLI_vector.hh.
|
inlinenoexcept |
Create an empty vector. This does not do any memory allocation.
Definition at line 131 of file BLI_vector.hh.
|
inlinenoexcept |
Definition at line 139 of file BLI_vector.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 148 of file BLI_vector.hh.
|
inline |
Create a vector filled with a specific value.
Definition at line 157 of file BLI_vector.hh.
|
inline |
Create a vector from an array ref. The values in the vector are copy constructed.
Definition at line 167 of file BLI_vector.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 182 of file BLI_vector.hh.
|
inline |
Definition at line 186 of file BLI_vector.hh.
|
inline |
Definition at line 193 of file BLI_vector.hh.
|
inline |
Definition at line 201 of file BLI_vector.hh.
|
inline |
Create a vector from a ListBase. The caller has to make sure that the values in the linked list have the correct type.
Example Usage: Vector<ModifierData *> modifiers(ob->modifiers);
Definition at line 216 of file BLI_vector.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 227 of file BLI_vector.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 BLI_vector.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 BLI_vector.hh.
References AT, blender::Vector< T, InlineBufferCapacity, Allocator >::capacity(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), T, blender::uninitialized_relocate_n(), and UPDATE_VECTOR_SIZE.
|
inline |
Definition at line 282 of file BLI_vector.hh.
References blender::destruct_n(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
Referenced by blender::tests::TEST().
|
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 438 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append_unchecked().
Referenced by blender::ResourceScope::add(), blender::compositor::NodeOperationBuilder::add_complex_operation_buffers(), blender::compositor::NodeOperationBuilder::add_datatype_conversions(), blender::fn::MFNetwork::add_function(), blender::deg::DepsgraphNodeBuilder::add_id_node(), blender::deg::Depsgraph::add_id_node(), InstancesComponent::add_instance(), CryptomatteSession::add_layer(), blender::compositor::NodeOperationBuilder::add_operation_input_constants(), blender::deg::DepsgraphNodeBuilder::add_operation_node(), blender::fn::MFParamsBuilder::add_readonly_single_input(), blender::fn::MFParamsBuilder::add_readonly_vector_input(), blender::fn::MFParamsBuilder::add_single_mutable(), blender::fn::MFParamsBuilder::add_uninitialized_single_output(), blender::fn::MFParamsBuilder::add_vector_mutable(), blender::fn::MFParamsBuilder::add_vector_output(), blender::compositor::CryptomatteOperation::addObjectIndex(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_and_get_index(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_non_duplicates(), asset_operation_get_ids_from_context(), BKE_nodetree_error_message_add(), BLI_string_search_add(), BLI_string_search_query(), compute_geometry(), compute_vertex_mask__armature_mode(), blender::nodes::create_function_for_node_that_expands_into_multiple(), blender::deg::deg_graph_transitive_reduction(), blender::nodes::determine_final_data_type_and_domain(), blender::compositor::NodeOperationBuilder::determineResolutions(), GeometryNodesEvaluator::execute(), blender::nodes::GeoNodeExecParams::extract_multi_input(), blender::string_search::extract_normalized_words(), blender::deg::ComponentNode::finalize_build(), blender::fn::mf_network_optimization::find_constant_inputs_to_fold(), blender::fn::mf_network_optimization::find_nodes_based_on_mask(), blender::fn::mf_network_optimization::find_non_constant_nodes(), find_spreadsheet_editors(), generate_unique_instance_ids(), blender::nodes::geo_node_boolean_exec(), blender::bke::geometry_set_collect_recursive(), GeometrySet::get_components_for_read(), blender::nodes::DInputSocket::get_corresponding_group_input_sockets(), blender::nodes::NodeMFNetworkBuilder::get_default_fn(), blender::nodes::GeoNodeExecParams::get_highest_priority_input_domain(), blender::nodes::get_instanced_data__collection(), blender::nodes::get_result_domain(), blender::ed::spreadsheet::get_selected_corner_indices(), blender::ed::spreadsheet::get_selected_edge_indices(), blender::ed::spreadsheet::get_selected_face_indices(), blender::ed::spreadsheet::get_selected_vertex_indices(), GPU_debug_group_begin(), gpu_select_query_load_id(), GPU_shader_create_ex(), blender::nodes::insert_dummy_node(), blender::nodes::join_component_type(), blender::bke::join_instance_groups_mesh(), make_recursive_duplis(), object_duplilist(), blender::LinearAllocator< Allocator >::provide_buffer(), blender::compositor::NodeOperationBuilder::prune_operations(), blender::deg::Relation::Relation(), blender::fn::mf_network_optimization::relink_duplicate_nodes(), blender::compositor::NodeOperationBuilder::resolve_proxies(), blender::nodes::sample_mesh_surface(), blender::compositor::sort_operations_recursive(), standard_defines(), blender::tests::TEST(), blender::nodes::DerivedNodeTree::to_dot(), blender::nodes::NodeTreeRef::to_dot(), and blender::fn::MFNetwork::to_dot().
|
inline |
Definition at line 443 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append_unchecked().
|
inline |
Append the value to the vector and return the index that can be used to access the newly added value.
Definition at line 453 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
Referenced by blender::tests::TEST().
|
inline |
Insert the same element n times at the end of the vector. This might result in a reallocation internally.
Definition at line 489 of file BLI_vector.hh.
References BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::increase_size_by_unchecked(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and blender::uninitialized_fill_n().
Referenced by blender::nodes::geo_node_boolean_exec(), and blender::HashTableStats::HashTableStats().
|
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 465 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), and blender::Vector< T, InlineBufferCapacity, Allocator >::contains().
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::extend_non_duplicates(), and blender::tests::TEST().
|
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 477 of file BLI_vector.hh.
References BLI_assert, T, and UPDATE_VECTOR_SIZE.
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::append(), and computed_masked_polygons().
|
inline |
Definition at line 345 of file BLI_vector.hh.
Referenced by blender::gpu::sort_input_list().
|
inline |
Definition at line 340 of file BLI_vector.hh.
Referenced by BLI_string_search_add(), blender::fn::mf_network_optimization::constant_folding(), blender::fn::mf_network_optimization::relink_duplicate_nodes(), blender::tests::TEST(), and try_get_socket_to_preview_for_spreadsheet().
|
inline |
Definition at line 833 of file BLI_vector.hh.
Referenced by BLI_string_search_query(), blender::Vector< T, InlineBufferCapacity, Allocator >::rend(), and blender::tests::TEST().
|
inline |
Definition at line 842 of file BLI_vector.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 873 of file BLI_vector.hh.
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), and blender::Vector< T, InlineBufferCapacity, Allocator >::Vector().
|
inline |
Afterwards the vector has 0 elements, but will still have memory to be refilled again.
Definition at line 408 of file BLI_vector.hh.
References blender::destruct_n(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and UPDATE_VECTOR_SIZE.
Referenced by blender::deg::DepsgraphNodeBuilder::begin_build(), InstancesComponent::clear(), blender::deg::Depsgraph::clear_id_nodes(), blender::deg::ComponentNode::clear_operations(), and blender::gpu::GLSharedOrphanLists::orphans_clear().
|
inline |
Afterwards the vector has 0 elements and any allocated memory will be freed.
Definition at line 419 of file BLI_vector.hh.
References blender::destruct_n(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and UPDATE_VECTOR_SIZE.
|
inline |
Do a linear search to see of the value is in the vector. Return true when it exists, otherwise false.
Definition at line 804 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::first_index_of_try().
Referenced by CryptomatteSession::add_layer(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_non_duplicates(), make_recursive_duplis(), and blender::tests::TEST().
|
inline |
Get access to the underlying array.
Definition at line 820 of file BLI_vector.hh.
Referenced by BKE_volume_grid_selection_surface(), BKE_volume_grid_wireframe(), blender::gpu::GLSharedOrphanLists::orphans_clear(), blender::tests::TEST(), and blender::gpu::GLQueryPool::~GLQueryPool().
|
inline |
Get access to the underlying array.
Definition at line 828 of file BLI_vector.hh.
|
inline |
Definition at line 837 of file BLI_vector.hh.
Referenced by BLI_string_search_query(), blender::Vector< T, InlineBufferCapacity, Allocator >::extend(), blender::Vector< T, InlineBufferCapacity, Allocator >::rbegin(), and blender::tests::TEST().
|
inline |
Definition at line 846 of file BLI_vector.hh.
|
inline |
|
inline |
Definition at line 554 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::end(), blender::Vector< T, InlineBufferCapacity, Allocator >::insert(), and blender::Vector< T, InlineBufferCapacity, Allocator >::last().
|
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 515 of file BLI_vector.hh.
References blender::Span< T >::data(), and array< T, alignment >::size().
Referenced by BLI_string_search_query(), blender::fn::mf_network_optimization::find_non_constant_nodes(), blender::tests::TEST(), and blender::fn::MFNetwork::to_dot().
|
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 530 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append_non_duplicates(), and T.
Referenced by blender::tests::TEST().
|
inline |
Definition at line 545 of file BLI_vector.hh.
References BLI_assert, blender::uninitialized_copy_n(), and UPDATE_VECTOR_SIZE.
|
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 541 of file BLI_vector.hh.
References blender::Span< T >::data(), and array< T, alignment >::size().
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::extend().
|
inline |
Copies the given value to every element in the vector.
Definition at line 812 of file BLI_vector.hh.
References blender::initialized_fill_n(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
Referenced by blender::tests::TEST().
|
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 793 of file BLI_vector.hh.
References BLI_assert, and blender::Vector< T, InlineBufferCapacity, Allocator >::first_index_of_try().
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::remove_first_occurrence_and_reorder(), and blender::tests::TEST().
|
inline |
Do a linear search to find the value in the vector. When found, return the first index, otherwise return -1.
Definition at line 779 of file BLI_vector.hh.
References T.
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::contains(), blender::Vector< T, InlineBufferCapacity, Allocator >::first_index_of(), and blender::tests::TEST().
|
inlinenoexcept |
Enlarges the size of the internal buffer that is considered to be initialized. This invokes undefined behavior when 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 503 of file BLI_vector.hh.
References BLI_assert, and UPDATE_VECTOR_SIZE.
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::append_n_times().
|
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 887 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::size().
Referenced by blender::fn::MFNetwork::add_function(), BLI_string_search_query(), blender::fn::mf_network_optimization::constant_folding(), and blender::HashTableStats::print().
|
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 564 of file BLI_vector.hh.
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::extend(), blender::Vector< T, InlineBufferCapacity, Allocator >::insert(), blender::Vector< T, InlineBufferCapacity, Allocator >::prepend(), and blender::tests::TEST().
|
inline |
Definition at line 582 of file BLI_vector.hh.
References BLI_assert, blender::destruct_n(), distance(), blender::Vector< T, InlineBufferCapacity, Allocator >::last(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), T, blender::uninitialized_copy_n(), and UPDATE_VECTOR_SIZE.
|
inline |
Definition at line 573 of file BLI_vector.hh.
References array< T, alignment >::begin(), array< T, alignment >::end(), and blender::Vector< T, InlineBufferCapacity, Allocator >::insert().
|
inline |
Definition at line 568 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::insert().
|
inline |
Definition at line 577 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::insert(), and blender::Vector< T, InlineBufferCapacity, Allocator >::last().
|
inline |
Returns true when the vector contains no elements, otherwise false.
This is the same as std::vector::empty.
Definition at line 674 of file BLI_vector.hh.
Referenced by blender::compositor::NodeOperationBuilder::add_output_buffers(), blender::deg::deg_debug_graphviz_node(), blender::deg::deg_graph_remove_unused_noops(), blender::nodes::geo_node_point_distribute_exec(), blender::nodes::get_instanced_data__collection(), blender::deg::is_unused_noop(), node_add_error_message_button(), blender::gpu::GLSharedOrphanLists::orphans_clear(), blender::Vector< T, InlineBufferCapacity, Allocator >::pop_last(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove_last(), blender::ed::spreadsheet::spreadsheet_context_update_tag(), blender::tests::TEST(), and blender::gpu::GLContext::~GLContext().
|
inline |
Definition at line 653 of file BLI_vector.hh.
References BLI_assert, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inline |
Return a reference to the last element in the vector. This invokes undefined behavior when the vector is empty.
Definition at line 648 of file BLI_vector.hh.
References BLI_assert, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::extend(), blender::Vector< T, InlineBufferCapacity, Allocator >::insert(), blender::Vector< T, InlineBufferCapacity, Allocator >::prepend(), blender::tests::TEST(), and try_get_socket_to_preview_for_spreadsheet().
|
inline |
Definition at line 323 of file BLI_vector.hh.
|
inline |
Definition at line 335 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inline |
Definition at line 318 of file BLI_vector.hh.
|
inline |
Definition at line 329 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inline |
Definition at line 290 of file BLI_vector.hh.
References blender::copy_assign_container().
|
inline |
Definition at line 295 of file BLI_vector.hh.
References blender::move_assign_container().
|
inline |
Definition at line 311 of file BLI_vector.hh.
References BLI_assert, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inline |
Get the value at the given index. This invokes undefined behavior when the index is out of bounds.
Definition at line 304 of file BLI_vector.hh.
References BLI_assert, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
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 697 of file BLI_vector.hh.
References BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), T, and UPDATE_VECTOR_SIZE.
Referenced by GPU_debug_group_end(), and blender::tests::TEST().
|
inline |
Insert values at the beginning of the vector. The has to move all the other elements, so it has a linear running time.
Definition at line 627 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::insert().
Referenced by blender::tests::TEST().
|
inline |
Definition at line 639 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::insert(), and blender::Vector< T, InlineBufferCapacity, Allocator >::last().
|
inline |
Definition at line 635 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::insert().
|
inline |
Definition at line 631 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::insert().
|
inline |
Print some debug information about the vector.
Definition at line 905 of file BLI_vector.hh.
References BLI_str_format_byte_unit(), and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inline |
Definition at line 851 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::end().
Referenced by blender::tests::TEST().
|
inline |
Definition at line 860 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::end().
|
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 741 of file BLI_vector.hh.
References BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and UPDATE_VECTOR_SIZE.
Referenced by blender::tests::TEST().
|
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 760 of file BLI_vector.hh.
References BLI_assert, blender::destruct_n(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and UPDATE_VECTOR_SIZE.
|
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 711 of file BLI_vector.hh.
References BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::size(), T, and UPDATE_VECTOR_SIZE.
Referenced by blender::nodes::eliminate_points_based_on_mask(), blender::nodes::geo_node_point_distribute_exec(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove_first_occurrence_and_reorder(), and blender::tests::TEST().
|
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 728 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::first_index_of(), and blender::Vector< T, InlineBufferCapacity, Allocator >::remove_and_reorder().
Referenced by blender::tests::TEST(), and blender::deg::Relation::unlink().
|
inline |
Destructs the last element and decreases the size by one. This invokes undefined behavior when the vector is empty.
Definition at line 683 of file BLI_vector.hh.
References BLI_assert, blender::Vector< T, InlineBufferCapacity, Allocator >::is_empty(), and UPDATE_VECTOR_SIZE.
Referenced by make_recursive_duplis(), and blender::tests::TEST().
|
inline |
Definition at line 855 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::begin().
Referenced by blender::tests::TEST().
|
inline |
Definition at line 864 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::begin().
|
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 355 of file BLI_vector.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::capacity().
Referenced by blender::Vector< T, InlineBufferCapacity, Allocator >::append_n_times(), BMeshFairingContext::BMeshFairingContext(), computed_masked_polygons(), blender::Vector< T, InlineBufferCapacity, Allocator >::extend(), blender::deg::ComponentNode::finalize_build(), blender::Vector< T, InlineBufferCapacity, Allocator >::insert(), MeshFairingContext::MeshFairingContext(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::compositor::NodeOperationBuilder::sort_operations(), blender::tests::TEST(), UniformVertexWeight::UniformVertexWeight(), and VoronoiVertexWeight::VoronoiVertexWeight().
|
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 368 of file BLI_vector.hh.
References BLI_assert, blender::default_construct_n(), blender::destruct_n(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), and UPDATE_VECTOR_SIZE.
Referenced by blender::gpu::GLQueryPool::begin_query(), mesh_init_origspace(), and blender::tests::TEST().
|
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 389 of file BLI_vector.hh.
References BLI_assert, blender::destruct_n(), blender::Vector< T, InlineBufferCapacity, Allocator >::reserve(), blender::Vector< T, InlineBufferCapacity, Allocator >::size(), blender::uninitialized_fill_n(), and UPDATE_VECTOR_SIZE.
|
inline |
Return how many values are currently stored in the vector.
Definition at line 662 of file BLI_vector.hh.
References BLI_assert.
Referenced by blender::fn::MFNetwork::add_function(), InstancesComponent::almost_unique_ids(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_and_get_index(), blender::Vector< T, InlineBufferCapacity, Allocator >::append_n_times(), blender::gpu::GLQueryPool::begin_query(), BKE_volume_grid_selection_surface(), BKE_volume_grid_wireframe(), BLI_string_search_query(), blender::Vector< T, InlineBufferCapacity, Allocator >::clear(), blender::Vector< T, InlineBufferCapacity, Allocator >::clear_and_make_inline(), compute_geometry(), computed_masked_polygons(), blender::fn::mf_network_optimization::constant_folding(), blender::compositor::CryptomatteNode::create_cryptomatte_operation(), DEG_debug_compare(), DEG_debug_consistency_check(), DEG_iterator_ids_begin(), DEG_iterator_objects_begin(), DEG_stats_simple(), blender::nodes::distribute_points_poisson_disk(), blender::nodes::eliminate_points_based_on_mask(), blender::Vector< T, InlineBufferCapacity, Allocator >::extend(), blender::Vector< T, InlineBufferCapacity, Allocator >::fill(), blender::nodes::geo_node_point_distribute_exec(), blender::deg::ComponentNode::get_entry_operation(), blender::deg::ComponentNode::get_exit_operation(), blender::nodes::GeoNodeExecParams::get_highest_priority_input_domain(), blender::nodes::get_instanced_data__collection(), blender::nodes::get_result_domain(), blender::compositor::NodeOperation::getNumberOfInputSockets(), blender::compositor::NodeOperation::getNumberOfOutputSockets(), GPU_debug_get_groups_names(), GPU_debug_group_begin(), blender::HashTableStats::HashTableStats(), blender::Vector< T, InlineBufferCapacity, Allocator >::index_range(), blender::Vector< T, InlineBufferCapacity, Allocator >::insert(), InstancesComponent::instances_amount(), InstancesComponent::is_empty(), blender::nodes::join_component_type(), blender::Vector< T, InlineBufferCapacity, Allocator >::last(), blender::fn::MFNetwork::node_id_amount(), blender::Vector< blender::compositor::CPUDevice >::operator MutableSpan< blender::compositor::CPUDevice >(), blender::Vector< T, InlineBufferCapacity, Allocator >::operator MutableSpan< U >(), blender::Vector< blender::compositor::CPUDevice >::operator Span< blender::compositor::CPUDevice >(), blender::Vector< T, InlineBufferCapacity, Allocator >::operator Span< U >(), blender::Vector< T, InlineBufferCapacity, Allocator >::operator[](), blender::gpu::GLSharedOrphanLists::orphans_clear(), blender::ResourceScope::print(), blender::Vector< T, InlineBufferCapacity, Allocator >::print_stats(), blender::fn::mf_network_optimization::relink_duplicate_nodes(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove(), blender::Vector< T, InlineBufferCapacity, Allocator >::remove_and_reorder(), blender::Vector< T, InlineBufferCapacity, Allocator >::resize(), blender::fn::MFNetwork::socket_id_amount(), blender::ed::spreadsheet::spreadsheet_context_update_tag(), standard_defines(), blender::tests::TEST(), blender::string_search::tests::TEST(), try_get_socket_to_preview_for_spreadsheet(), blender::Vector< T, InlineBufferCapacity, Allocator >::Vector(), blender::gpu::GLQueryPool::~GLQueryPool(), blender::ResourceScope::~ResourceScope(), and blender::Vector< T, InlineBufferCapacity, Allocator >::~Vector().
|
friend |
Definition at line 897 of file BLI_vector.hh.
|
friend |
Definition at line 892 of file BLI_vector.hh.
|
friend |
Be a friend with other vector instantiations. This is necessary to implement some memory management logic.
Definition at line 124 of file BLI_vector.hh.