Fix weird bug in IOPort

This commit is contained in:
Jaby 2023-01-08 15:16:00 +01:00
parent 3d57dfdc92
commit 3c1d965cc5
1 changed files with 3 additions and 2 deletions

View File

@ -9,8 +9,9 @@ namespace JabyEngine {
T value; T value;
public: public:
// decltype(this) instead of IOPort<T>* lead to wrong runtime behaviour somethow...
constexpr T read() const { constexpr T read() const {
return const_cast<const volatile decltype(this)>(this)->value; return const_cast<const volatile IOPort<T>*>(this)->value;
} }
template<typename...ARGS> template<typename...ARGS>
@ -24,7 +25,7 @@ namespace JabyEngine {
} }
constexpr void write(const T& value) { constexpr void write(const T& value) {
const_cast<volatile decltype(this)>(this)->value = value; const_cast<volatile IOPort<T>*>(this)->value = value;
} }
// We keep this a POD so we will not add assignment operators anymore // We keep this a POD so we will not add assignment operators anymore