Blender V5.0
blender::ArrayState< T > Class Template Reference

#include <BLI_array_state.hh>

Public Member Functions

 ArrayState ()=default
 ArrayState (const VArray< T > &values, const ImplicitSharingInfo *sharing_info)
bool is_empty () const
bool same_as (const VArray< T > &other_values, const ImplicitSharingInfo *other_sharing_info) const

Detailed Description

template<typename T>
class blender::ArrayState< T >

Remembers the values in an array and allows checking if another array in the future has exactly the same values. This is useful for checking if the topology of a mesh has changed.

If possible, this class makes use of implicit-sharing to avoid creating unnecessary copies of the data. This also allows detecting that the array is not changed in constant time in common cases.

Definition at line 27 of file BLI_array_state.hh.

Constructor & Destructor Documentation

◆ ArrayState() [1/2]

template<typename T>
blender::ArrayState< T >::ArrayState ( )
default

◆ ArrayState() [2/2]

Member Function Documentation

◆ is_empty()

template<typename T>
bool blender::ArrayState< T >::is_empty ( ) const
inline

True when the remembered array does not contain any values.

Definition at line 60 of file BLI_array_state.hh.

Referenced by blender::bke::attribute_reader_matches_array_state().

◆ same_as()

template<typename T>
bool blender::ArrayState< T >::same_as ( const VArray< T > & other_values,
const ImplicitSharingInfo * other_sharing_info ) const
inline

True when the remembered array contains the same values as the given array. This is O(1) in the case when the array was shared and has not been modified. If determining equality in constant time is not possible, the method falls back to comparing the values individually which will take O(n) time.

Definition at line 71 of file BLI_array_state.hh.

References blender::VArrayCommon< T >::size().

Referenced by blender::bke::attribute_reader_matches_array_state().


The documentation for this class was generated from the following file: