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>
|
template<typename T>
|
||||||
T read(int socket)
|
T read(int socket)
|
||||||
{
|
{
|
||||||
char value[sizeof(T)];
|
union
|
||||||
|
{
|
||||||
|
T object;
|
||||||
|
char value[sizeof(T)];
|
||||||
|
};
|
||||||
read(socket, value, sizeof(T));
|
read(socket, value, sizeof(T));
|
||||||
return *(T*)(value);
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user