Packet& Packet::operator<<(int8_t value)
{
- return *this << (uint8_t)value;
+ return *this << reinterpret_cast<uint8_t&>(value);
}
Packet& Packet::operator<<(int16_t value)
{
- return *this << (uint16_t)value;
+ return *this << reinterpret_cast<uint16_t&>(value);
}
Packet& Packet::operator<<(int32_t value)
{
- return *this << (uint32_t)value;
+ return *this << reinterpret_cast<uint32_t&>(value);
}
Packet& Packet::operator<<(int64_t value)
{
- return *this << (uint64_t)value;
+ return *this << reinterpret_cast<uint64_t&>(value);
}
Packet& Packet::operator>>(int8_t& value)
{
- return *this >> (uint8_t&)value;
+ return *this >> reinterpret_cast<uint8_t&>(value);
}
Packet& Packet::operator>>(int16_t& value)
{
- return *this >> (uint16_t&)value;
+ return *this >> reinterpret_cast<uint16_t&>(value);
}
Packet& Packet::operator>>(int32_t& value)
{
- return *this >> (uint32_t&)value;
+ return *this >> reinterpret_cast<uint32_t&>(value);
}
Packet& Packet::operator>>(int64_t& value)
{
- return *this >> (uint64_t&)value;
+ return *this >> reinterpret_cast<uint64_t&>(value);
}
Packet& Packet::operator>>(uint8_t& value)
* \param type The type of socket; either SOCK_STREAM or SOCK_DGRAM.
* \param family The family; can be AF_INET or AF_INET6.
*/
- SocketAddress(const std::string& service,
- int type = SOCK_STREAM,
- int family = AF_UNSPEC)
+ explicit SocketAddress(const std::string& service,
+ int type = SOCK_STREAM,
+ int family = AF_UNSPEC)
{
init(service, type, family);
}
* \param family The family; can be AF_INET or AF_INET6.
* \param flags The socket options.
*/
- Socket(const std::string& service,
- int type = SOCK_STREAM,
- int family = AF_UNSPEC,
- int flags = 0) :
+ explicit Socket(const std::string& service,
+ int type = SOCK_STREAM,
+ int family = AF_UNSPEC,
+ int flags = 0) :
mImpl(SocketAddress(service, type, family), flags) {}
Packet&,
const SocketAddress&)> Function;
- SocketMultiplexer(Socket sock) :
+ explicit SocketMultiplexer(Socket sock) :
mSocket(sock) {}