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