fix c++11 union use in remote.cc
This commit is contained in:
parent
3c8df764be
commit
c6f08f6c34
|
@ -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<>
|
||||
|
|
Loading…
Reference in New Issue
Block a user