Minor fixup of vm::ptr

const pointers shouldn't disable reading, they should disable writing.
This commit is contained in:
Eladash 2021-07-17 19:21:17 +03:00 committed by Megamouse
parent 81805945ce
commit a981c65d2f

View file

@ -204,13 +204,13 @@ namespace vm
return *this;
}
template <bool = false> requires (!std::is_void_v<T> && !std::is_const_v<T>)
bool try_read(std::conditional_t<std::is_void_v<T>, char, T>& out) const
template <bool = false> requires (!std::is_void_v<T>)
bool try_read(std::conditional_t<std::is_void_v<T>, char, std::remove_const_t<T>>& out) const
{
return vm::try_access(vm::cast(m_addr), &out, sizeof(T), false);
}
template <bool = false> requires (!std::is_void_v<T>)
template <bool = false> requires (!std::is_void_v<T> && !std::is_const_v<T>)
bool try_write(const std::conditional_t<std::is_void_v<T>, char, T>& _in) const
{
return vm::try_access(vm::cast(m_addr), const_cast<T*>(&_in), sizeof(T), true);