fix c++11 union use in remote.cc

This commit is contained in:
Maxime Coste 2013-07-31 00:32:51 +02:00
parent 3c8df764be
commit c6f08f6c34

View File

@ -132,13 +132,15 @@ void read(int socket, char* buffer, size_t size)
template<typename T> template<typename T>
T read(int socket) T read(int socket)
{ {
union union U
{ {
T object; T object;
char value[sizeof(T)]; char data[sizeof(T)];
}; U() {}
read(socket, value, sizeof(T)); ~U() { object.~T(); }
return object; } u;
read(socket, u.data, sizeof(T));
return u.object;
} }
template<> template<>