From 0b43d984905f07c59e3236d98d4e27409aba3cda Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 17 Jan 2025 16:23:24 +0100 Subject: More stuff with templates --- templates/println.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 templates/println.cpp (limited to 'templates/println.cpp') diff --git a/templates/println.cpp b/templates/println.cpp new file mode 100644 index 0000000..62f27ac --- /dev/null +++ b/templates/println.cpp @@ -0,0 +1,18 @@ +#include + +template void println() { std::cout << X << std::endl; } + +int main() { + println<1.23>(); + println<42>(); + + // The following attempts to print a string do not work + // uncomment to see why + // 1. + // println<"Hello!">(); + // 2. + // constexpr std::string_view hello = "Hello!"; + // println(); + + return 0; +} -- cgit v1.3