diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-12-09 12:01:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-12-09 12:01:44 +0300 |
commit | 9e365069afe156f33fadfad9705e1325f894cd54 (patch) | |
tree | 78373044d029feb51f987b45208e0c1a36958625 /source/blender/blenlib/BLI_index_mask.hh | |
parent | d8b42751625c915113b64f5a2d9c72f19f009fee (diff) |
Cleanup: move public doc-strings into headers for 'blenlib'
- Added space below non doc-string comments to make it clear
these aren't comments for the symbols directly below them.
- Use doxy sections for some headers.
- Minor improvements to doc-strings.
Ref T92709
Diffstat (limited to 'source/blender/blenlib/BLI_index_mask.hh')
-rw-r--r-- | source/blender/blenlib/BLI_index_mask.hh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_index_mask.hh b/source/blender/blenlib/BLI_index_mask.hh index 16bb8c931cc..2dca3689cb1 100644 --- a/source/blender/blenlib/BLI_index_mask.hh +++ b/source/blender/blenlib/BLI_index_mask.hh @@ -45,11 +45,11 @@ namespace blender { class IndexMask { private: - /* The underlying reference to sorted integers. */ + /** The underlying reference to sorted integers. */ Span<int64_t> indices_; public: - /* Creates an IndexMask that contains no indices. */ + /** Creates an IndexMask that contains no indices. */ IndexMask() = default; /** @@ -224,6 +224,24 @@ class IndexMask { } IndexMask slice(IndexRange slice) const; + /** + * Create a sub-mask that is also shifted to the beginning. + * The shifting to the beginning allows code to work with smaller indices, + * which is more memory efficient. + * + * \return New index mask with the size of #slice. It is either empty or starts with 0. + * It might reference indices that have been appended to #r_new_indices. + * + * Example: + * \code{.unparsed} + * this: [2, 3, 5, 7, 8, 9, 10] + * slice: ^--------^ + * output: [0, 2, 4, 5] + * \endcode + * + * All the indices in the sub-mask are shifted by 3 towards zero, + * so that the first index in the output is zero. + */ IndexMask slice_and_offset(IndexRange slice, Vector<int64_t> &r_new_indices) const; }; |