|
Blender
V2.93
|
#include <BLI_span.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 | size_type = int64_t |
Public Member Functions | |
| constexpr | MutableSpan ()=default |
| constexpr | MutableSpan (T *start, const int64_t size) |
| constexpr | MutableSpan (std::vector< T > &vector) |
| template<std::size_t N> | |
| constexpr | MutableSpan (std::array< T, N > &array) |
| template<typename U , typename std::enable_if_t< is_span_convertible_pointer_v< U, T >> * = nullptr> | |
| constexpr | MutableSpan (MutableSpan< U > span) |
| constexpr | operator Span< T > () const |
| template<typename U , typename std::enable_if_t< is_span_convertible_pointer_v< T, U >> * = nullptr> | |
| constexpr | operator Span< U > () const |
| constexpr int64_t | size () const |
| constexpr bool | is_empty () const |
| constexpr void | fill (const T &value) |
| constexpr void | fill_indices (Span< int64_t > indices, const T &value) |
| constexpr T * | data () const |
| constexpr T * | begin () const |
| constexpr T * | end () const |
| constexpr std::reverse_iterator< T * > | rbegin () const |
| constexpr std::reverse_iterator< T * > | rend () const |
| constexpr T & | operator[] (const int64_t index) const |
| constexpr MutableSpan | slice (const int64_t start, const int64_t size) const |
| constexpr MutableSpan | drop_front (const int64_t n) const |
| constexpr MutableSpan | drop_back (const int64_t n) const |
| constexpr MutableSpan | take_front (const int64_t n) const |
| constexpr MutableSpan | take_back (const int64_t n) const |
| constexpr Span< T > | as_span () const |
| constexpr IndexRange | index_range () const |
| constexpr T & | last () const |
| constexpr int64_t | count (const T &value) const |
| constexpr void | copy_from (Span< T > values) |
| template<typename NewT > | |
| constexpr MutableSpan< NewT > | cast () const |
Mostly the same as Span, except that one can change the array elements through a MutableSpan.
Definition at line 470 of file BLI_span.hh.
| using blender::MutableSpan< T >::const_pointer = const T * |
Definition at line 474 of file BLI_span.hh.
| using blender::MutableSpan< T >::const_reference = const T & |
Definition at line 476 of file BLI_span.hh.
| using blender::MutableSpan< T >::iterator = T * |
Definition at line 477 of file BLI_span.hh.
| using blender::MutableSpan< T >::pointer = T * |
Definition at line 473 of file BLI_span.hh.
| using blender::MutableSpan< T >::reference = T & |
Definition at line 475 of file BLI_span.hh.
| using blender::MutableSpan< T >::size_type = int64_t |
Definition at line 478 of file BLI_span.hh.
| using blender::MutableSpan< T >::value_type = T |
Definition at line 472 of file BLI_span.hh.
|
constexprdefault |
|
inlineconstexpr |
Definition at line 487 of file BLI_span.hh.
References data_.
|
inlineconstexpr |
Definition at line 491 of file BLI_span.hh.
|
inlineconstexpr |
Definition at line 496 of file BLI_span.hh.
|
inlineconstexpr |
Support implicit conversions like the one below: MutableSpan<T *> -> MutableSpan<const T *>
Definition at line 505 of file BLI_span.hh.
References data_.
|
inlineconstexpr |
Returns an (immutable) Span that references the same array. This is usually not needed, due to implicit conversions. However, sometimes automatic type deduction needs some help.
Definition at line 650 of file BLI_span.hh.
References data_.
|
inlineconstexpr |
Definition at line 566 of file BLI_span.hh.
References data_.
Referenced by blender::MutableSpan< T >::rend().
|
inlineconstexpr |
Returns a new span to the same underlying memory buffer. No conversions are done. The caller is responsible for making sure that the type cast is valid.
Definition at line 704 of file BLI_span.hh.
References BLI_assert, data_, and T.
Referenced by blender::LinearAllocator< Allocator >::construct_elements_and_pointer_array().
|
inlineconstexpr |
Copy all values from another span into this span. This invokes undefined behavior when the destination contains uninitialized data and T is not trivially copy constructible. The size of both spans is expected to be the same.
Definition at line 694 of file BLI_span.hh.
References BLI_assert, blender::Span< T >::data(), data_, blender::initialized_copy_n(), and blender::Span< T >::size().
Referenced by blender::gpu::sort_input_list(), and blender::tests::TEST().
|
inlineconstexpr |
Does a linear search to count how often the value is in the array. Returns the number of occurrences.
Definition at line 678 of file BLI_span.hh.
|
inlineconstexpr |
Returns a pointer to the beginning of the referenced array. This may be nullptr, when the size is zero.
Definition at line 561 of file BLI_span.hh.
References data_.
Referenced by blender::LinearAllocator< Allocator >::construct_array_copy(), and blender::tests::TEST().
|
inlineconstexpr |
Returns a new MutableSpan with n elements removed from the end. This invokes undefined behavior when n is negative.
Definition at line 617 of file BLI_span.hh.
References BLI_assert, data_, and blender::MutableSpan< T >::MutableSpan().
|
inlineconstexpr |
Returns a new MutableSpan with n elements removed from the beginning. This invokes undefined behavior when n is negative.
Definition at line 606 of file BLI_span.hh.
References BLI_assert, data_, and blender::MutableSpan< T >::MutableSpan().
Referenced by blender::tests::TEST().
|
inlineconstexpr |
Definition at line 570 of file BLI_span.hh.
References data_.
Referenced by blender::MutableSpan< T >::rbegin().
|
inlineconstexpr |
Replace all elements in the referenced array with the given value.
Definition at line 540 of file BLI_span.hh.
References data_, and blender::initialized_fill_n().
Referenced by blender::bke::adapt_mesh_domain_face_to_corner_impl(), blender::string_search::match_word_initials(), and blender::tests::TEST().
|
inlineconstexpr |
Replace a subset of all elements with the given value. This invokes undefined behavior when one of the indices is out of bounds.
Definition at line 549 of file BLI_span.hh.
References BLI_assert, data_, and indices.
Referenced by blender::tests::TEST().
|
inlineconstexpr |
Utility to make it more convenient to iterate over all indices that can be used with this array.
Definition at line 659 of file BLI_span.hh.
Referenced by blender::nodes::clamp_attribute(), compute_masked_vertices(), compute_vertex_mask__armature_mode(), compute_vertex_mask__vertex_group_mode(), blender::nodes::execute_on_component(), blender::nodes::fill_edge_data(), blender::attribute_math::SimpleMixer< T >::finalize(), blender::attribute_math::SimpleMixerWithAccumulationType< T, AccumulationT, ConvertToT >::finalize(), blender::nodes::interpolate_attribute_face(), blender::nodes::map_range_float(), blender::nodes::map_range_float3(), blender::nodes::randomize_attribute(), and blender::nodes::randomize_attribute_bool().
|
inlineconstexpr |
Returns true if the size is zero.
Definition at line 532 of file BLI_span.hh.
Referenced by blender::tests::TEST().
|
inlineconstexpr |
Returns a reference to the last element. This invokes undefined behavior when the array is empty.
Definition at line 668 of file BLI_span.hh.
References BLI_assert, and data_.
|
inlineconstexpr |
Definition at line 510 of file BLI_span.hh.
|
inlineconstexpr |
Definition at line 516 of file BLI_span.hh.
References data_.
|
inlineconstexpr |
Definition at line 584 of file BLI_span.hh.
References BLI_assert, data_, and blender::MutableSpan< T >::size().
|
inlineconstexpr |
Definition at line 575 of file BLI_span.hh.
References blender::MutableSpan< T >::end().
Referenced by blender::tests::TEST().
|
inlineconstexpr |
Definition at line 579 of file BLI_span.hh.
References blender::MutableSpan< T >::begin().
Referenced by blender::tests::TEST().
|
inlineconstexpr |
Returns the number of elements in the array.
Definition at line 524 of file BLI_span.hh.
Referenced by blender::bke::adapt_mesh_domain_corner_to_edge_impl(), blender::bke::adapt_mesh_domain_corner_to_face_impl(), blender::bke::adapt_mesh_domain_corner_to_point_impl(), blender::bke::adapt_mesh_domain_edge_to_corner_impl(), blender::bke::adapt_mesh_domain_edge_to_face_impl(), blender::bke::adapt_mesh_domain_edge_to_point_impl(), blender::bke::adapt_mesh_domain_face_to_corner_impl(), blender::bke::adapt_mesh_domain_face_to_edge_impl(), blender::bke::adapt_mesh_domain_face_to_point_impl(), blender::bke::adapt_mesh_domain_point_to_corner_impl(), blender::bke::adapt_mesh_domain_point_to_edge_impl(), blender::bke::adapt_mesh_domain_point_to_face_impl(), compute_masked_vertices(), computed_masked_edges(), blender::nodes::do_math_operation(), blender::RandomNumberGenerator::get_bytes(), blender::gpu::GLQueryPool::get_occlusion_result(), blender::MutableSpan< T >::operator[](), blender::nodes::point_rotate_on_component(), blender::bke::calc_edges::reserve_hash_maps(), blender::bke::calc_edges::serialize_and_initialize_deduplicated_edges(), blender::RandomNumberGenerator::shuffle(), blender::MutableSpan< T >::slice(), blender::gpu::sort_input_list(), and blender::tests::TEST().
|
inlineconstexpr |
Returns a contiguous part of the array. This invokes undefined behavior when the start or size is negative.
Definition at line 594 of file BLI_span.hh.
References BLI_assert, data_, min, blender::MutableSpan< T >::MutableSpan(), and blender::MutableSpan< T >::size().
Referenced by blender::bke::adapt_mesh_domain_face_to_corner_impl(), blender::nodes::compute_special_attributes(), and blender::tests::TEST().
|
inlineconstexpr |
Return a new MutableSpan that only contains the last n elements. This invokes undefined behavior when n is negative.
Definition at line 639 of file BLI_span.hh.
References BLI_assert, data_, and blender::MutableSpan< T >::MutableSpan().
Referenced by blender::tests::TEST().
|
inlineconstexpr |
Returns a new MutableSpan that only contains the first n elements. This invokes undefined behavior when n is negative.
Definition at line 628 of file BLI_span.hh.
References BLI_assert, data_, and blender::MutableSpan< T >::MutableSpan().
Referenced by blender::tests::TEST().