From becd7327cf886db0ed2f486c34bb3d487a984a0a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 29 Jun 2024 12:13:52 +0100 Subject: Tidy InstanceProxy --- gfx/gl/instanceVertices.h | 13 ++++++++----- 1 file 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 #include #include @@ -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 - T & + InstanceProxy & operator=(U && v) { - return instances->lookup(index) = std::forward(v); + instances->lookup(index) = std::forward(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); -- cgit v1.2.3