read<T>(int socket): type aliasing compliance

This commit is contained in:
Maxime Coste 2013-07-26 01:30:01 +02:00
parent a4138201b0
commit 233cb530fc

View File

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