diff options
author | Jacques Lucke <jacques@blender.org> | 2022-07-07 20:19:01 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-07 20:19:18 +0300 |
commit | ba62e20af67e1de25f781456df7175fa1b31db67 (patch) | |
tree | 28e4dcd2701e94d4c4e5f9c2c41a9635da7e6389 /source/blender/blenlib/BLI_generic_virtual_array.hh | |
parent | 7cfea48752ebc544104d57d19736c201a98bc3cd (diff) |
BLI: make some spans default constructible
`GSpan` and spans based on virtual arrays were not default constructible
before, which made them hard to use sometimes. It's generally fine for
spans to be empty.
The main thing the keep in mind is that the type pointer in `GSpan` may
be null now. Generally, code receiving spans as input can assume that
the type is not-null, but sometimes that may be valid. The old #type() method
that returned a reference to the type still exists. It asserts when the
type is null.
Diffstat (limited to 'source/blender/blenlib/BLI_generic_virtual_array.hh')
-rw-r--r-- | source/blender/blenlib/BLI_generic_virtual_array.hh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_generic_virtual_array.hh b/source/blender/blenlib/BLI_generic_virtual_array.hh index 3526925c2e2..43ca16a894f 100644 --- a/source/blender/blenlib/BLI_generic_virtual_array.hh +++ b/source/blender/blenlib/BLI_generic_virtual_array.hh @@ -267,6 +267,7 @@ class GVArraySpan : public GSpan { void *owned_data_ = nullptr; public: + GVArraySpan(); GVArraySpan(GVArray varray); GVArraySpan(GVArraySpan &&other); ~GVArraySpan(); @@ -282,11 +283,14 @@ class GMutableVArraySpan : public GMutableSpan, NonCopyable, NonMovable { bool show_not_saved_warning_ = true; public: + GMutableVArraySpan(); GMutableVArraySpan(GVMutableArray varray, bool copy_values_to_span = true); GMutableVArraySpan(GMutableVArraySpan &&other); ~GMutableVArraySpan(); GMutableVArraySpan &operator=(GMutableVArraySpan &&other); + const GVMutableArray &varray() const; + void save(); void disable_not_applied_warning(); }; |