Util/Manual: cast via void* to avoid alignment warnings

This commit is contained in:
Max Kellermann 2014-12-09 23:10:05 +01:00
parent 1889150013
commit dbbcbc3616
1 changed files with 4 additions and 2 deletions

View File

@ -95,13 +95,15 @@ public:
T &Get() {
assert(initialized);
return *(T *)data;
void *p = static_cast<void *>(data);
return *static_cast<T *>(p);
}
const T &Get() const {
assert(initialized);
return *(const T *)data;
const void *p = static_cast<const void *>(data);
return *static_cast<const T *>(p);
}
operator T &() {