taming-cpp

Experiments with C++ and comparisons with C
git clone https://git.tronto.net/taming-cpp
Download | Log | Files | Refs | README

println.cpp (341B)


      1 #include <iostream>
      2 
      3 template<auto X> void println() { std::cout << X << std::endl; }
      4 
      5 int main() {
      6 	println<1.23>();
      7 	println<42>();
      8 
      9 	// The following attempts to print a string do not work
     10 	// uncomment to see why
     11 	// 1.
     12 	// println<"Hello!">();
     13 	// 2.
     14 	// constexpr std::string_view hello = "Hello!";
     15 	// println<hello>();
     16 
     17 	return 0;
     18 }