mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +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;
|
using namespace boost;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
union data_field {
|
||||||
|
char buffer[sizeof(T)];
|
||||||
|
T value;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T sread(std::istream& s) {
|
T sread(std::istream& s) {
|
||||||
char buf[sizeof(T)];
|
data_field<T> data;
|
||||||
s.read(buf, sizeof(T));
|
s.read(data.buffer, sizeof(T));
|
||||||
return *((T*)buf);
|
return data.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|||||||
Reference in New Issue
Block a user