Fix weird bug in IOPort

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

View File

@ -9,8 +9,9 @@ namespace JabyEngine {
T value;
public:
// decltype(this) instead of IOPort<T>* lead to wrong runtime behaviour somethow...
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>
@ -24,7 +25,7 @@ namespace JabyEngine {
}
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