Blender
V3.3
|
#include <BLI_array.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 | |
Array (Allocator allocator={}) noexcept | |
Array (NoExceptConstructor, Allocator allocator={}) noexcept | |
template<typename U , BLI_ENABLE_IF((std::is_convertible_v< U, T >)) > | |
Array (Span< U > values, Allocator allocator={}) | |
template<typename U , BLI_ENABLE_IF((std::is_convertible_v< U, T >)) > | |
Array (const std::initializer_list< U > &values, Allocator allocator={}) | |
Array (const std::initializer_list< T > &values, Allocator allocator={}) | |
Array (int64_t size, Allocator allocator={}) | |
Array (int64_t size, const T &value, Allocator allocator={}) | |
Array (int64_t size, NoInitialization, Allocator allocator={}) | |
Array (const Array &other) | |
Array (Array &&other) noexcept(std::is_nothrow_move_constructible_v< T >) | |
~Array () | |
Array & | operator= (const Array &other) |
Array & | operator= (Array &&other) noexcept(std::is_nothrow_move_constructible_v< T >) |
T & | operator[] (int64_t index) |
const T & | operator[] (int64_t index) const |
operator Span< T > () const | |
operator MutableSpan< T > () | |
template<typename U , BLI_ENABLE_IF((is_span_convertible_pointer_v< T, U >)) > | |
operator Span< U > () const | |
template<typename U , BLI_ENABLE_IF((is_span_convertible_pointer_v< T, U >)) > | |
operator MutableSpan< U > () | |
Span< T > | as_span () const |
MutableSpan< T > | as_mutable_span () |
int64_t | size () const |
bool | is_empty () const |
void | fill (const T &value) const |
const T & | first () const |
T & | first () |
const T & | last (const int64_t n=0) const |
T & | last (const int64_t n=0) |
const T * | data () const |
T * | data () |
const T * | begin () const |
const T * | end () const |
T * | begin () |
T * | end () |
std::reverse_iterator< T * > | rbegin () |
std::reverse_iterator< T * > | rend () |
std::reverse_iterator< const T * > | rbegin () const |
std::reverse_iterator< const T * > | rend () const |
IndexRange | index_range () const |
void | clear_without_destruct () |
Allocator & | allocator () |
const Allocator & | allocator () const |
void | reinitialize (const int64_t new_size) |
Static Public Member Functions | |
static int64_t | inline_buffer_capacity () |
Definition at line 48 of file BLI_array.hh.
using blender::Array< T, InlineBufferCapacity, Allocator >::const_iterator = const T * |
Definition at line 56 of file BLI_array.hh.
using blender::Array< T, InlineBufferCapacity, Allocator >::const_pointer = const T * |
Definition at line 52 of file BLI_array.hh.
using blender::Array< T, InlineBufferCapacity, Allocator >::const_reference = const T & |
Definition at line 54 of file BLI_array.hh.
using blender::Array< T, InlineBufferCapacity, Allocator >::iterator = T * |
Definition at line 55 of file BLI_array.hh.
using blender::Array< T, InlineBufferCapacity, Allocator >::pointer = T * |
Definition at line 51 of file BLI_array.hh.
using blender::Array< T, InlineBufferCapacity, Allocator >::reference = T & |
Definition at line 53 of file BLI_array.hh.
using blender::Array< T, InlineBufferCapacity, Allocator >::size_type = int64_t |
Definition at line 57 of file BLI_array.hh.
using blender::Array< T, InlineBufferCapacity, Allocator >::value_type = T |
Definition at line 50 of file BLI_array.hh.
|
inlinenoexcept |
By default an empty array is created.
Definition at line 76 of file BLI_array.hh.
|
inlinenoexcept |
Definition at line 82 of file BLI_array.hh.
|
inline |
Create a new array that contains copies of all values.
Definition at line 90 of file BLI_array.hh.
|
inline |
Create a new array that contains copies of all values.
Definition at line 102 of file BLI_array.hh.
|
inline |
Definition at line 107 of file BLI_array.hh.
|
inlineexplicit |
Create a new array with the given size. All values will be default constructed. For trivial types like int, default construction does nothing.
We might want another version of this in the future, that does not do default construction even for non-trivial types. This should not be the default though, because one can easily mess up when dealing with uninitialized memory.
Definition at line 120 of file BLI_array.hh.
|
inline |
Create a new array with the given size. All values will be initialized by copying the given default.
Definition at line 131 of file BLI_array.hh.
|
inline |
Create a new array with uninitialized elements. The caller is responsible for constructing the elements. Moving, copying or destructing an Array with uninitialized elements invokes undefined behavior.
This should be used very rarely. Note, that the normal size-constructor also does not initialize the elements when T is trivially constructible. Therefore, it only makes sense to use this with non trivially constructible types.
Usage: Array<std::string> my_strings(10, NoInitialization());
Definition at line 152 of file BLI_array.hh.
|
inline |
Definition at line 160 of file BLI_array.hh.
|
inlinenoexcept |
Definition at line 164 of file BLI_array.hh.
References data_, and blender::uninitialized_relocate_n().
|
inline |
Definition at line 179 of file BLI_array.hh.
References data_, and blender::destruct_n().
Referenced by blender::MutableVArraySpan< T >::MutableVArraySpan(), and blender::VArraySpan< T >::VArraySpan().
|
inline |
Access the allocator used by this array.
Definition at line 365 of file BLI_array.hh.
|
inline |
Definition at line 369 of file BLI_array.hh.
|
inline |
Definition at line 236 of file BLI_array.hh.
Referenced by blender::nodes::node_geo_distribute_points_on_faces_cc::calc_full_density_factors_with_selection(), blender::nodes::node_geo_uv_pack_islands_cc::construct_uv_gvarray(), blender::nodes::node_geo_extrude_mesh_cc::extrude_individual_mesh_faces(), blender::nodes::node_geo_edge_paths_to_selection_cc::PathToEdgeSelectionFieldInput::get_varray_for_context(), blender::nodes::node_geo_merge_by_distance_cc::mesh_merge_by_distance_connected(), blender::geometry::point_merge_by_distance(), blender::bke::tests::TEST(), and blender::fn::tests::TEST().
|
inline |
Definition at line 231 of file BLI_array.hh.
Referenced by blender::InplacePriorityQueue< T, FirstHasHigherPriority >::active_indices(), attribute_search_update_fn(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_mesh(), blender::geometry::fillet_curves(), blender::InplacePriorityQueue< T, FirstHasHigherPriority >::inactive_indices(), blender::bke::VArrayImpl_For_SplinePosition::materialize(), blender::bke::VArrayImpl_For_BezierHandles::materialize(), blender::bke::VArrayImpl_For_SplinePosition::materialize_to_uninitialized(), blender::bke::VArrayImpl_For_BezierHandles::materialize_to_uninitialized(), InstancesComponent::remove_unused_references(), blender::ed::sculpt_paint::select_grow::select_grow_update(), blender::geometry::subdivide_curves(), blender::fn::tests::TEST(), and blender::length_parameterize::tests::TEST().
|
inline |
Definition at line 318 of file BLI_array.hh.
References data_.
|
inline |
Definition at line 309 of file BLI_array.hh.
References data_.
Referenced by blender::nodes::node_geo_attribute_statistic_cc::node_geo_exec(), and blender::Array< T, InlineBufferCapacity, Allocator >::rend().
|
inline |
Sets the size to zero. This should only be used when you have manually destructed all elements in the array beforehand. Use with care.
Definition at line 357 of file BLI_array.hh.
|
inline |
Definition at line 304 of file BLI_array.hh.
References data_.
|
inline |
Get a pointer to the beginning of the array.
Definition at line 300 of file BLI_array.hh.
References data_.
Referenced by blendthumb_extract_from_file_impl(), bm_face_create_from_mpoly(), BMD_mesh_intersection(), blender::nodes::node_geo_uv_unwrap_cc::construct_uv_gvarray(), blender::nodes::node_geo_uv_pack_islands_cc::construct_uv_gvarray(), blender::geometry::create_merged_mesh(), blender::string_search::damerau_levenshtein_distance(), file_seek(), CBlendThumb::GetThumbnail(), image_load_image_file(), image_load_movie_file(), blender::geometry::mesh_merge_by_distance_all(), blender::geometry::mesh_merge_by_distance_connected(), mesh_uv_reset_bmface(), mesh_uv_reset_mface(), blender::MutableVArraySpan< T >::MutableVArraySpan(), blender::nodes::node_geo_deform_curves_on_surface_cc::node_geo_exec(), object_origin_set_exec(), blender::geometry::point_merge_by_distance(), blender::io::stl::read_stl_binary(), blender::MutableVArraySpan< T >::save(), sorted_selected_editable_objects(), blender::tests::TEST(), thumb_data_vertical_flip(), and blender::VArraySpan< T >::VArraySpan().
|
inline |
Definition at line 322 of file BLI_array.hh.
References data_.
|
inline |
Definition at line 313 of file BLI_array.hh.
References data_.
Referenced by blender::nodes::node_geo_attribute_statistic_cc::node_geo_exec(), and blender::Array< T, InlineBufferCapacity, Allocator >::rbegin().
|
inline |
Copies the given value to every element in the array.
Definition at line 260 of file BLI_array.hh.
References data_, and blender::initialized_fill_n().
Referenced by blender::bke::VArray_For_SplineToPoint< T >::materialize(), blender::geometry::point_merge_by_distance(), blender::geometry::subdivide_curves(), blender::geometry::weld_edge_groups_setup(), and blender::geometry::weld_vert_groups_setup().
|
inline |
Definition at line 274 of file BLI_array.hh.
References BLI_assert, and data_.
|
inline |
Return a reference to the first element in the array. This invokes undefined behavior when the array is empty.
Definition at line 269 of file BLI_array.hh.
References BLI_assert, and data_.
Referenced by blender::ed::sculpt_paint::move_last_point_and_resample(), blender::nodes::node_geo_attribute_statistic_cc::node_geo_exec(), and blender::nodes::node_geo_dual_mesh_cc::sort_vertex_polys().
|
inline |
Get an index range containing all valid indices for this array.
Definition at line 348 of file BLI_array.hh.
Referenced by blender::nodes::node_geo_dual_mesh_cc::calc_dual_mesh(), blender::bke::copy_with_removed_points(), blender::bke::VArrayImpl_For_BezierHandles::get_handle_spans(), blender::bke::VArrayImpl_For_SplinePosition::get_position_spans(), blender::nodes::node_geo_input_shortest_edge_paths_cc::ShortestEdgePathsNextVertFieldInput::get_varray_for_context(), blender::nodes::node_geo_input_shortest_edge_paths_cc::ShortestEdgePathsCostFieldInput::get_varray_for_context(), blender::geometry::interpolate_position_with_interpolation(), blender::ed::sculpt_paint::move_last_point_and_resample(), object_origin_set_exec(), blender::geometry::point_merge_by_distance(), blender::bke::CustomDataAttributes::reorder(), blender::bke::tests::TEST(), and blender::length_parameterize::tests::TEST().
|
inlinestatic |
Get the value of the InlineBufferCapacity template argument. This is the number of elements that can be stored without doing an allocation.
Definition at line 378 of file BLI_array.hh.
|
inline |
Returns true when the number of elements in the array is zero.
Definition at line 252 of file BLI_array.hh.
Referenced by apply_objects_internal(), blendthumb_create_png_data_from_thumb(), BM_mesh_bm_from_me(), blender::GVectorArray::is_empty(), and object_origin_set_exec().
|
inline |
Definition at line 290 of file BLI_array.hh.
References BLI_assert, and data_.
|
inline |
Return a reference to the nth last element. This invokes undefined behavior when the array is too short.
Definition at line 284 of file BLI_array.hh.
References BLI_assert, and data_.
Referenced by blender::nodes::node_geo_duplicate_elements_cc::accumulate_counts_to_offsets(), CurveEval::accumulated_spline_lengths(), blender::nodes::node_geo_curve_to_points_cc::calculate_spline_point_offsets(), CurveEval::control_point_offsets(), blender::bke::curve_to_mesh_sweep(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_curves(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_edges(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_curve(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_mesh(), blender::nodes::node_geo_duplicate_elements_cc::duplicate_points_pointcloud(), CurveEval::evaluated_point_offsets(), blender::nodes::node_geo_extrude_mesh_cc::extrude_individual_mesh_faces(), blender::geometry::interpolate_position_with_interpolation(), blender::bke::VArray_For_SplineToPoint< T >::materialize(), blender::bke::VArray_For_SplineToPoint< T >::materialize_to_uninitialized(), blender::ed::sculpt_paint::move_last_point_and_resample(), blender::nodes::node_geo_attribute_statistic_cc::node_geo_exec(), blender::nodes::node_geo_curve_sample_cc::node_geo_exec(), blender::nodes::node_geo_curve_to_points_cc::node_geo_exec(), blender::geometry::point_merge_by_distance(), and Spline::sample_uniform_index_factors().
|
inline |
Definition at line 214 of file BLI_array.hh.
|
inline |
Definition at line 226 of file BLI_array.hh.
References data_.
|
inline |
Definition at line 209 of file BLI_array.hh.
|
inline |
Definition at line 220 of file BLI_array.hh.
References data_.
|
inlinenoexcept |
Definition at line 190 of file BLI_array.hh.
References blender::move_assign_container().
|
inline |
Definition at line 185 of file BLI_array.hh.
References blender::copy_assign_container().
|
inline |
Definition at line 195 of file BLI_array.hh.
References BLI_assert, and data_.
|
inline |
Definition at line 202 of file BLI_array.hh.
References BLI_assert, and data_.
|
inline |
Definition at line 327 of file BLI_array.hh.
References blender::Array< T, InlineBufferCapacity, Allocator >::end().
|
inline |
Definition at line 336 of file BLI_array.hh.
References blender::Array< T, InlineBufferCapacity, Allocator >::end().
|
inline |
Destruct values and create a new array of the given size. The values in the new array are default constructed.
Definition at line 387 of file BLI_array.hh.
References BLI_assert, data_, blender::default_construct_n(), blender::destruct_n(), and T.
Referenced by BM_mesh_bm_from_me(), blender::nodes::node_geo_curve_sample_cc::SampleCurveFunction::call(), blender::nodes::node_geo_raycast_cc::RaycastFunction::call(), blender::nodes::node_geo_transfer_attribute_cc::NearestTransferFunction::call(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::nodes::node_geo_string_to_curves_cc::get_text_layout(), blender::MutableVArraySpan< T >::MutableVArraySpan(), blender::nodes::node_geo_attribute_statistic_cc::node_geo_exec(), blender::geometry::preprocess_meshes(), blender::ed::sculpt_paint::select_grow::select_grow_invoke_per_curve(), blender::geometry::weld_edge_groups_setup(), and blender::geometry::weld_vert_groups_setup().
|
inline |
Definition at line 331 of file BLI_array.hh.
References blender::Array< T, InlineBufferCapacity, Allocator >::begin().
|
inline |
Definition at line 340 of file BLI_array.hh.
References blender::Array< T, InlineBufferCapacity, Allocator >::begin().
|
inline |
Returns the number of elements in the array.
Definition at line 244 of file BLI_array.hh.
Referenced by blender::compositor::MultiThreadedRowOperation::PixelCursor::next(), object_origin_set_exec(), blender::GVectorArray::size(), and blender::tests::TEST().