std :; string has a default constructor that will be used to create _ip (assuming it's a string). Then you can safely assign it. However, using an initialization list is best practice:
TCPConnector(int32_t fd, string ip, uint16_t port, vector<uint32_t>& protocolChain, const Variant& customParameters) : IOHandler(fd, IOHT_TCP_CONNECTOR), _ip( ip ), _port( port ), _protocolChain( protocolChain ), _closeSocket( true ), _customParameters( customParameters ) { }
This uses copy construction to create objects of type _ip, not the default, and then for assignment. This is more efficient and is required for classes that do not support the default construct but provide other constructors, such as the copy constructor.
anon
source share