summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-08-27 20:52:15 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-08-27 20:52:15 +0100
commit5154a87f1d7861c2e0ac01ecc552603ceedad55b (patch)
treef485515e94ff3606d4a7e45b555150e9e90c1a08 /lib
parentAdd raw() view of RawDataReader (diff)
downloadmygrate-5154a87f1d7861c2e0ac01ecc552603ceedad55b.tar.bz2
mygrate-5154a87f1d7861c2e0ac01ecc552603ceedad55b.tar.xz
mygrate-5154a87f1d7861c2e0ac01ecc552603ceedad55b.zip
Prevent reading of non-trivial types from RawDataReader
Diffstat (limited to 'lib')
-rw-r--r--lib/rawDataReader.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/rawDataReader.h b/lib/rawDataReader.h
index b23de88..c3a537a 100644
--- a/lib/rawDataReader.h
+++ b/lib/rawDataReader.h
@@ -36,6 +36,7 @@ namespace MyGrate {
typename type_map<T>::target
readValue(size_t L)
{
+ static_assert(std::is_trivial_v<T>, "Do not read non-trivial types");
verify<std::logic_error>(L > 0 && L <= sizeof(T), "Read exceeds target size");
offsetSizeCheck(L);
T v {};