//******************************************************** // The following code example is taken from the book // C++20 - The Complete Guide // by Nicolai M. Josuttis (www.josuttis.com) // http://www.cppstd20.com // // The code is licensed under a // Creative Commons Attribution 4.0 International License // http://creativecommons.org/licenses/by/4.0/ //******************************************************** #include #include template class Logger { //... public: void log(std::string_view msg) const { std::cout << Prefix << msg << '\n'; } }; template struct Str { char chars[N]; const char* value() { return chars; } friend std::ostream& operator<< (std::ostream& strm, const Str& s) { return strm << s.chars; } }; template Str(const char(&)[N]) -> Str; // deduction guide int main() { Logger "}> logger; logger.log("hello"); }