read<T>(int socket): type aliasing compliance
This commit is contained in:
parent
a4138201b0
commit
233cb530fc
|
@ -132,9 +132,13 @@ void read(int socket, char* buffer, size_t size)
|
|||
template<typename T>
|
||||
T read(int socket)
|
||||
{
|
||||
union
|
||||
{
|
||||
T object;
|
||||
char value[sizeof(T)];
|
||||
};
|
||||
read(socket, value, sizeof(T));
|
||||
return *(T*)(value);
|
||||
return object;
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Reference in New Issue
Block a user