#pragma once // Logger.h #include #include #include template struct Converter { static std::string toString(const T& t) { std::ostringstream out; out << t; return out.str(); } }; struct DoLog { void log(const std::string& msg) { std::cout << msg; } }; struct NoLog { void log(const std::string& msg) {} }; struct ILogger { virtual void log(const std::string& msg) = 0; }; template class Logger : public ILogger { public: virtual void log(const std::string& msg) override { t.log(msg); } private: T t; };