From 21649c4fe8d10b21fcf0febaf404cd9ee03d4613 Mon Sep 17 00:00:00 2001 From: jaby Date: Sun, 26 Nov 2023 18:54:24 -0500 Subject: [PATCH] Limit concat to non pointer types to avoid hard to track problems --- include/PSX/Auxiliary/type_traits.hpp | 17 +++++++++++++++++ include/PSX/GPU/Primitives/linked_elements.hpp | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/include/PSX/Auxiliary/type_traits.hpp b/include/PSX/Auxiliary/type_traits.hpp index fb6f89bd..8ca970c5 100644 --- a/include/PSX/Auxiliary/type_traits.hpp +++ b/include/PSX/Auxiliary/type_traits.hpp @@ -69,6 +69,23 @@ namespace JabyEngine { struct conjunction : conditional, B1>::type { }; + // ############################################# + + template + struct is_pointer : false_type {}; + + template + struct is_pointer : true_type {}; + + template + struct is_pointer : true_type {}; + + template + struct is_pointer : true_type {}; + + template + struct is_pointer : true_type {}; + // ############################################# template diff --git a/include/PSX/GPU/Primitives/linked_elements.hpp b/include/PSX/GPU/Primitives/linked_elements.hpp index b8dbdce3..d2cfeb1d 100644 --- a/include/PSX/GPU/Primitives/linked_elements.hpp +++ b/include/PSX/GPU/Primitives/linked_elements.hpp @@ -1,5 +1,6 @@ #pragma once #include "../../Auxiliary/bits.hpp" +#include "../../Auxiliary/type_traits.hpp" namespace JabyEngine { namespace GPU { @@ -37,13 +38,13 @@ namespace JabyEngine { } template - T& concat(T& obj) { + enable_if::value, T&>::type concat(T& obj) { Link::set_adr(&obj); return obj; } template - const T& concat(const T& obj) { + enable_if::value, const T&>::type concat(const T& obj) { return concat(const_cast(obj)); }