handy invalid handle macro

This commit is contained in:
2026-09-24 23:00:45 -07:00
parent b5d28ce3eb
commit 75fc14f4ac
2 changed files with 12 additions and 6 deletions
+9
View File
@@ -24,6 +24,15 @@ struct Handle {
[[nodiscard]] auto operator<=>(const Handle&) const = default; [[nodiscard]] auto operator<=>(const Handle&) const = default;
}; };
struct InvalidHandle {
template <typename T>
[[nodiscard]] constexpr operator Handle<T>() const {
return Handle<T>::invalid();
}
};
inline constexpr InvalidHandle INVALID_HANDLE{};
class Mesh; class Mesh;
class Panel; class Panel;
class RenderTarget; class RenderTarget;
+3 -6
View File
@@ -1,6 +1,9 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
#include <glm/glm.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <iostream> #include <iostream>
#include <random> #include <random>
#include <sophia/application.hpp> #include <sophia/application.hpp>
@@ -10,12 +13,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>
#include <glm/gtc/constants.hpp>
#include <glm/gtc/matrix_transform.hpp>
struct Boid { struct Boid {
glm::vec2 position; glm::vec2 position;
glm::vec2 velocity; glm::vec2 velocity;