Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-10-03 16:01:02 +0300
committerJacques Lucke <jacques@blender.org>2021-10-03 16:01:02 +0300
commit0998856c923f28b1cf2199b945e3eb70cbface96 (patch)
treea575b3cc60e8ca74f11aa4e7521df7e114ed48fe /source/blender/blenkernel/BKE_attribute_access.hh
parent8fc97a871fa34a0413093bb12c2825e963482a45 (diff)
Cleanup: use movable output attribute instead of optional
This simplifies the code a bit and improves compile times a bit.
Diffstat (limited to 'source/blender/blenkernel/BKE_attribute_access.hh')
-rw-r--r--source/blender/blenkernel/BKE_attribute_access.hh11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh
index 25ee4d3c132..ef43e21b739 100644
--- a/source/blender/blenkernel/BKE_attribute_access.hh
+++ b/source/blender/blenkernel/BKE_attribute_access.hh
@@ -248,6 +248,7 @@ template<typename T> class OutputAttribute_Typed {
VMutableArray<T> *varray_ = nullptr;
public:
+ OutputAttribute_Typed() = default;
OutputAttribute_Typed(OutputAttribute attribute) : attribute_(std::move(attribute))
{
if (attribute_) {
@@ -259,6 +260,16 @@ template<typename T> class OutputAttribute_Typed {
OutputAttribute_Typed(OutputAttribute_Typed &&other) = default;
~OutputAttribute_Typed() = default;
+ OutputAttribute_Typed &operator=(OutputAttribute_Typed &&other)
+ {
+ if (this == &other) {
+ return *this;
+ }
+ this->~OutputAttribute_Typed();
+ new (this) OutputAttribute_Typed(std::move(other));
+ return *this;
+ }
+
operator bool() const
{
return varray_ != nullptr;