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>
T read(int socket)
{
union
union U
{
T object;
char value[sizeof(T)];
};
read(socket, value, sizeof(T));
return object;
char data[sizeof(T)];
U() {}
~U() { object.~T(); }
} u;
read(socket, u.data, sizeof(T));
return u.object;
}
template<>