mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
use union to remove warning (issue 105). (#108)
This commit is contained in:
committed by
Thomas Krijnen
parent
240133515a
commit
42067de44c
@@ -46,11 +46,17 @@
|
||||
|
||||
using namespace boost;
|
||||
|
||||
template <typename T>
|
||||
union data_field {
|
||||
char buffer[sizeof(T)];
|
||||
T value;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T sread(std::istream& s) {
|
||||
char buf[sizeof(T)];
|
||||
s.read(buf, sizeof(T));
|
||||
return *((T*)buf);
|
||||
data_field<T> data;
|
||||
s.read(data.buffer, sizeof(T));
|
||||
return data.value;
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
Reference in New Issue
Block a user