#include "write_irc.hpp" auto write_irc(Connection& connection, std::string message) -> void { message += "\r\n"; connection.write_raw(std::move(message)); } auto write_irc(Connection& connection, std::string front, std::string_view last) -> void { auto const is_invalid = [](char x) -> bool { return x == '\0' || x == '\r' || x == '\n'; }; if (last.end() != std::find_if(last.begin(), last.end(), is_invalid)) { throw std::runtime_error{"bad irc argument"}; } front += " :"; front += last; write_irc(connection, std::move(front)); }