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