|
Blender V4.3
|
#include <BLI_span.hh>
Inherited by blender::VArraySpan< T >.
Public Types | |
| using | value_type = T |
| using | pointer = T * |
| using | const_pointer = const T * |
| using | reference = T & |
| using | const_reference = const T & |
| using | iterator = const T * |
| using | size_type = int64_t |
Public Member Functions | |
| constexpr | Span ()=default |
| constexpr | Span (const T *start, int64_t size) |
| template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v< U, T >))> | |
| constexpr | Span (const U *start, int64_t size) |
| constexpr | Span (const std::initializer_list< T > &list) |
| constexpr | Span (const std::vector< T > &vector) |
| template<std::size_t N> | |
| constexpr | Span (const std::array< T, N > &array) |
| template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v< U, T >))> | |
| constexpr | Span (Span< U > span) |
| constexpr Span | slice (int64_t start, int64_t size) const |
| constexpr Span | slice (IndexRange range) const |
| constexpr Span | slice_safe (const int64_t start, const int64_t size) const |
| constexpr Span | slice_safe (IndexRange range) const |
| constexpr Span | drop_front (int64_t n) const |
| constexpr Span | drop_back (int64_t n) const |
| constexpr Span | take_front (int64_t n) const |
| constexpr Span | take_back (int64_t n) const |
| constexpr const T * | data () const |
| constexpr const T * | begin () const |
| constexpr const T * | end () const |
| constexpr std::reverse_iterator< const T * > | rbegin () const |
| constexpr std::reverse_iterator< const T * > | rend () const |
| constexpr const T & | operator[] (int64_t index) const |
| constexpr int64_t | size () const |
| constexpr bool | is_empty () const |
| constexpr int64_t | size_in_bytes () const |
| constexpr bool | contains (const T &value) const |
| constexpr bool | contains_ptr (const T *ptr) const |
| constexpr int64_t | count (const T &value) const |
| constexpr const T & | first () const |
| constexpr const T & | last (const int64_t n=0) const |
| constexpr bool | has_duplicates__linear_search () const |
| constexpr bool | intersects__linear_search (Span other) const |
| constexpr int64_t | first_index (const T &search_value) const |
| constexpr int64_t | first_index_try (const T &search_value) const |
| constexpr IndexRange | index_range () const |
| constexpr uint64_t | hash () const |
| template<typename NewT> | |
| Span< NewT > constexpr | cast () const |
Protected Attributes | |
| const T * | data_ = nullptr |
| int64_t | size_ = 0 |
Friends | |
| bool | operator== (const Span< T > a, const Span< T > b) |
| bool | operator!= (const Span< T > a, const Span< T > b) |
References an array of type T that is owned by someone else. The data in the array cannot be modified.
Definition at line 75 of file BLI_span.hh.
| using blender::Span< T >::const_pointer = const T * |
Definition at line 79 of file BLI_span.hh.
| using blender::Span< T >::const_reference = const T & |
Definition at line 81 of file BLI_span.hh.
| using blender::Span< T >::iterator = const T * |
Definition at line 82 of file BLI_span.hh.
| using blender::Span< T >::pointer = T * |
Definition at line 78 of file BLI_span.hh.
| using blender::Span< T >::reference = T & |
Definition at line 80 of file BLI_span.hh.
| using blender::Span< T >::size_type = int64_t |
Definition at line 83 of file BLI_span.hh.
| using blender::Span< T >::value_type = T |
Definition at line 77 of file BLI_span.hh.
|
constexprdefault |
Create a reference to an empty array.
Definition at line 95 of file BLI_span.hh.
Definition at line 101 of file BLI_span.hh.
|
inlineconstexpr |
Reference an initializer_list. Note that the data in the initializer_list is only valid until the expression containing it is fully computed.
Do: call_function_with_array({1, 2, 3, 4});
Don't: Span<int> span = {1, 2, 3, 4}; call_function_with_array(span);
Definition at line 117 of file BLI_span.hh.
|
inlineconstexpr |
Definition at line 121 of file BLI_span.hh.
|
inlineconstexpr |
Definition at line 123 of file BLI_span.hh.
Support implicit conversions like the one below: Span<T *> -> Span<const T *>
Definition at line 130 of file BLI_span.hh.
|
inlineconstexpr |
Definition at line 221 of file BLI_span.hh.
Referenced by blender::bke::pbvh::node_update_visibility_grids().
|
inlineconstexpr |
Returns a new Span to the same underlying memory buffer. No conversions are done.
Definition at line 419 of file BLI_span.hh.
|
inlineconstexpr |
Does a linear search to see of the value is in the array. Returns true if it is, otherwise false.
Definition at line 278 of file BLI_span.hh.
Referenced by blender::animrig::tests::TEST_F().
|
inlineconstexpr |
Does a constant time check to see if the pointer points to a value in the referenced array. Return true if it is, otherwise false.
Definition at line 292 of file BLI_span.hh.
|
inlineconstexpr |
Does a linear search to count how often the value is in the array. Returns the number of occurrences.
Definition at line 301 of file BLI_span.hh.
|
inlineconstexpr |
Returns the pointer to the beginning of the referenced array. This may be nullptr when the size is zero.
Definition at line 216 of file BLI_span.hh.
Referenced by blender::bke::Instances::almost_unique_ids(), closest_point_on_surface(), do_multires_bake(), blender::draw::extract_tan_init_common(), find_internal_spring_target_vertex(), blender::bke::subdiv::precalc_uv_layer(), blender::bke::Instances::reference_user_counts(), blender::bke::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), blender::geometry::tests::TEST(), and blender::geometry::tests::TEST().
|
inlineconstexpr |
Returns a new Span with n elements removed from the end. This invokes undefined behavior when n is negative.
Definition at line 183 of file BLI_span.hh.
Referenced by blender::create_envelope_strokes().
|
inlineconstexpr |
Returns a new Span with n elements removed from the beginning. This invokes undefined behavior when n is negative.
Definition at line 172 of file BLI_span.hh.
Referenced by blender::bke::pbvh::update_normals_mesh().
|
inlineconstexpr |
Definition at line 225 of file BLI_span.hh.
Referenced by blender::bke::pbvh::node_update_visibility_grids().
|
inlineconstexpr |
Return a reference to the first element in the array. This invokes undefined behavior when the array is empty.
Definition at line 316 of file BLI_span.hh.
Referenced by version_geometry_nodes_extrude_smooth_propagation().
|
inlineconstexpr |
Returns the index of the first occurrence of the given value. This invokes undefined behavior when the value is not in the array.
Definition at line 378 of file BLI_span.hh.
|
inlineconstexpr |
Returns the index of the first occurrence of the given value or -1 if it does not exist.
Definition at line 388 of file BLI_span.hh.
|
inlineconstexpr |
Check if the array contains duplicates. Does a linear search for every element. So the total running time is O(n^2). Only use this for small arrays.
Definition at line 337 of file BLI_span.hh.
|
inlineconstexpr |
Definition at line 407 of file BLI_span.hh.
|
inlineconstexpr |
Utility to make it more convenient to iterate over all indices that can be used with this array.
Definition at line 402 of file BLI_span.hh.
Referenced by ntree_exec_begin(), paintvert_select_less(), paintvert_select_linked_vertices(), and paintvert_select_more().
|
inlineconstexpr |
Returns true when this and the other array have an element in common. This should only be called on small arrays, because it has a running time of O(n*m) where n and m are the sizes of the arrays.
Definition at line 359 of file BLI_span.hh.
|
inlineconstexpr |
Returns true if the size is zero.
Definition at line 261 of file BLI_span.hh.
Referenced by achannel_is_part_of_disconnected_slot(), BKE_mesh_foreach_mapped_face_center(), blender::draw::calc_face_tri_starts_mesh(), blender::draw::calc_face_visibility_mesh(), blender::draw::calc_mesh_edge_visibility(), blender::draw::calc_vert_visibility_mapped_mesh(), blender::draw::calc_vert_visibility_mesh(), blender::draw::calc_visible_loose_edge_indices(), blender::geometry::convert_curves_to_nurbs(), blender::draw::draw_subdiv_cache_extra_coarse_face_data_mapped(), blender::draw::draw_subdiv_cache_extra_coarse_face_data_mesh(), blender::draw::extract_edituv_lines_mesh(), blender::draw::extract_edituv_lines_subdiv_mesh(), blender::draw::extract_normals_mesh(), blender::draw::extract_paint_overlay_flags(), blender::draw::extract_points_bm(), blender::draw::extract_vertex_flags(), fix_geometry_nodes_object_info_scale(), blender::bke::subdiv::get_edge_sharpness(), blender::bke::subdiv::get_vertex_sharpness(), getname_anim_fcurve_for_slot(), gradientVertInit__mapFunc(), paintvert_select_ungrouped(), and version_geometry_nodes_extrude_smooth_propagation().
|
inlineconstexpr |
Returns a reference to the nth last element. This invokes undefined behavior when the span is too short.
Definition at line 326 of file BLI_span.hh.
Referenced by blender::geometry::add_curves_on_mesh(), blender::geometry::fillet_curves(), blender::ed::curves::resize_curves(), blender::geometry::subdivide_curves(), and blender::geometry::trim_curves().
|
inlineconstexpr |
Access an element in the array. This invokes undefined behavior when the index is out of bounds.
Definition at line 243 of file BLI_span.hh.
|
inlineconstexpr |
Definition at line 230 of file BLI_span.hh.
|
inlineconstexpr |
Definition at line 234 of file BLI_span.hh.
|
inlineconstexpr |
Returns the number of elements in the referenced array.
Definition at line 253 of file BLI_span.hh.
Referenced by do_multires_bake(), blender::draw::extract_edge_index(), blender::draw::extract_edge_index_bm(), blender::draw::extract_edge_index_mesh(), blender::draw::extract_edit_data_bm(), blender::draw::extract_edit_data_mesh(), blender::draw::extract_edit_subdiv_data_bm(), blender::draw::extract_edit_subdiv_data_mesh(), blender::draw::extract_lines_mesh(), blender::draw::extract_loose_positions_subdiv(), blender::draw::extract_points_bm(), blender::draw::extract_points_mesh(), blender::draw::extract_positions_bm(), blender::draw::extract_positions_mesh(), blender::draw::extract_tan_init_common(), blender::draw::extract_vert_index_bm(), blender::draw::extract_vert_index_mesh(), blender::draw::extract_vert_normals_bm(), blender::draw::extract_vert_normals_mesh(), blender::ed::sculpt_paint::undo::fill_node_data_mesh(), blender::nodes::node_geo_scale_elements_cc::from_indices_large_groups(), lineart_geometry_object_load(), memset_laplacian_system(), mesh_calc_islands_loop_face_uv(), ntree_exec_begin(), blender::ed::sculpt_paint::orig_position_data_lookup_mesh(), paintvert_select_less(), blender::draw::subdiv_full_vbo_size(), blender::draw::subdiv_loose_edges_num(), uvprojectModifier_do(), and version_geometry_nodes_extrude_smooth_propagation().
|
inlineconstexpr |
Returns the number of bytes referenced by this Span.
Definition at line 269 of file BLI_span.hh.
Referenced by blender::draw::extract_points_mesh(), blender::draw::extract_positions_mesh(), and blender::ed::sculpt_paint::undo::node_size_in_bytes().
|
inlineconstexpr |
Definition at line 146 of file BLI_span.hh.
|
inlineconstexpr |
Returns a contiguous part of the array. This invokes undefined behavior when the start or size is negative.
Definition at line 138 of file BLI_span.hh.
Referenced by blender::io::obj::OBJMesh::calc_face_vert_indices(), blender::bke::evaluate_generic_data_for_curve(), blender::geometry::lookup_tris_in_cell(), paintface_minmax(), paintface_select_less(), paintface_select_linked_faces(), paintface_select_loop(), paintvert_select_less(), paintvert_select_more(), blender::ed::transform::curves::recent_position_offsets(), UVGroups::td_indices_get(), and uvprojectModifier_do().
|
inlineconstexpr |
Returns a contiguous part of the array. This invokes undefined behavior when the start or size is negative. Clamps the size of the new span so it fits in the current one.
Definition at line 155 of file BLI_span.hh.
Referenced by blender::bke::evaluate_generic_data_for_curve().
|
inlineconstexpr |
Definition at line 163 of file BLI_span.hh.
|
inlineconstexpr |
Returns a new Span that only contains the last n elements. This invokes undefined behavior when n is negative.
Definition at line 205 of file BLI_span.hh.
|
inlineconstexpr |
Returns a new Span that only contains the first n elements. This invokes undefined behavior when n is negative.
Definition at line 194 of file BLI_span.hh.
Referenced by blender::ed::sculpt_paint::undo::restore_mask_mesh().
Definition at line 434 of file BLI_span.hh.
Definition at line 426 of file BLI_span.hh.
|
protected |
Definition at line 86 of file BLI_span.hh.
|
protected |
Definition at line 87 of file BLI_span.hh.