diff options
Diffstat (limited to 'include/fud_c_file.hpp')
-rw-r--r-- | include/fud_c_file.hpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/fud_c_file.hpp b/include/fud_c_file.hpp index 0d52e95..3b7d821 100644 --- a/include/fud_c_file.hpp +++ b/include/fud_c_file.hpp @@ -256,6 +256,7 @@ class CFile { template <typename T> [[nodiscard]] ReadResult read(T& destination, size_t length) { + static_assert(not std::is_pointer_v<decltype(destination)>); auto& self = static_cast<Derived&>(*this); return self.read(destination, length, 0); } @@ -263,6 +264,7 @@ class CFile { template <typename T> [[nodiscard]] ReadResult read(T& destination, size_t length, size_t offset) { + static_assert(not std::is_pointer_v<decltype(destination)>); auto& self = static_cast<Derived&>(*this); return self.read(&destination, sizeof(destination), length, offset); } @@ -342,6 +344,7 @@ class CFile { template <typename T> [[nodiscard]] WriteResult write(const T& source) { + static_assert(not std::is_pointer_v<decltype(source)>); auto& self = static_cast<Derived&>(*this); return self.write(source, sizeof(source), sizeof(source)); } @@ -349,8 +352,9 @@ class CFile { template <typename T> [[nodiscard]] WriteResult write(const T& source, size_t sourceSize, size_t length) { + static_assert(not std::is_pointer_v<decltype(source)>); auto& self = static_cast<Derived&>(*this); - auto offsetResult = size(); + auto offsetResult = self.size(); if (offsetResult.isError()) { return WriteResult{0, offsetResult.getError()}; } @@ -360,6 +364,7 @@ class CFile { template <typename T> [[nodiscard]] WriteResult write(const T& source, size_t sourceSize, size_t length, size_t offset) { + static_assert(not std::is_pointer_v<decltype(source)>); auto& self = static_cast<Derived&>(*this); return self.write(static_cast<const void*>(&source), sourceSize, length, offset); } |