Duplication of code in write:
bool write(const std::vector<char>& buf, ...) and bool write(const std::string& buf, ...) should just defer to bool write(const char* buf, int len, ...)
bool write(const std::string& buf, std::function<void(error)> callback)
{
return write(buf.c_str(), buf.length(), callback);
}
bool write(const std::vector<char>& buf, std::function<void(error)> callback)
{
return write(&buf[0], buf.size(), callback);
}