summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-06-29 12:13:52 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-06-29 12:13:52 +0100
commitbecd7327cf886db0ed2f486c34bb3d487a984a0a (patch)
treebebf9d06564f3f855a61f40af9342e573f07d04d
parentAllow passing start index for instanced draw (diff)
downloadilt-becd7327cf886db0ed2f486c34bb3d487a984a0a.tar.bz2
ilt-becd7327cf886db0ed2f486c34bb3d487a984a0a.tar.xz
ilt-becd7327cf886db0ed2f486c34bb3d487a984a0a.zip
Tidy InstanceProxy
-rw-r--r--gfx/gl/instanceVertices.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/gfx/gl/instanceVertices.h b/gfx/gl/instanceVertices.h
index a89aa78..d9d9123 100644
--- a/gfx/gl/instanceVertices.h
+++ b/gfx/gl/instanceVertices.h
@@ -1,7 +1,6 @@
#pragma once
#include "glContainer.h"
-#include "pack.h"
#include <cassert>
#include <special_members.h>
#include <utility>
@@ -14,7 +13,8 @@ public:
public:
InstanceProxy(InstanceVertices * iv, std::size_t idx) : instances {iv}, index {idx} { }
- InstanceProxy(InstanceProxy && other) : instances {std::exchange(other.instances, nullptr)}, index {other.index}
+ InstanceProxy(InstanceProxy && other) noexcept :
+ instances {std::exchange(other.instances, nullptr)}, index {other.index}
{
}
@@ -28,7 +28,7 @@ public:
}
InstanceProxy &
- operator=(InstanceProxy && other)
+ operator=(InstanceProxy && other) noexcept
{
if (instances) {
instances->release(index);
@@ -39,17 +39,20 @@ public:
}
template<typename U>
- T &
+ InstanceProxy &
operator=(U && v)
{
- return instances->lookup(index) = std::forward<U>(v);
+ instances->lookup(index) = std::forward<U>(v);
+ return *this;
}
+ // NOLINTNEXTLINE)hicpp-explicit-conversions
[[nodiscard]] operator T &()
{
return instances->lookup(index);
}
+ // NOLINTNEXTLINE)hicpp-explicit-conversions
[[nodiscard]] operator const T &() const
{
return instances->lookup(index);