Making to_string as a virtual function accessible from sock_address class
Based on my observation and my usage, sometimes it is useful to get the string representation of the IP address of the socket. But in case you have a simple sock_address type object, you must do some additional actions (checking the type and casting) to have your job done correctly. For this purpose, I moved the to_string function up to sock_address class and made it virtual.
This seems like a good idea. But I would think to make it purely virtual function in the base class:
virtual std::string to_string() const =0;
That would force the child classes to output something useful.
But note that this, especially, would be a breaking change in the API. It could break someone's build if they used the sock_address class for an additional socket type in the library/application.
But note that this, especially, would be a breaking change in the API. It could break someone's build if they used the sock_address class for an additional socket type in the library/application.
That is why I specified default implementation. Maybe merging this to future branch with pure virtual implementation?