$ wc -c a.cpp t.cpp
399 a.cpp
380 t.cpp
779 total
$ cat t.cpp
#include <iostream>
using namespace std;
namespace utils {
template<typename T> T square(const T& n) { return n * n; }
}
int main() {
int input(0);
auto message("Please enter a positive number");
cout << message << ":\n";
cin >> input;
if (input>0) { cout << "Result: " << utils::square(input) << "\n"; }
else { cout << message << "\n"; }
return 0;
}
$ cat a.cpp
#include <iostream>
using namespace std
namespace utils
template<typename T>
auto square(const T& n)
return n * n
int main()
auto input = 0
auto message = "Please enter a positive number"
cout << message << ":" << endl
cin >> input
if input > 0
cout << "Result: " << utils::square(10) << endl
else
cout << message << endl
return 0
I am not entirely convinced that t.cpp has any more or less noise than a.cpp and where exactly there is any sort of gain from this – I had more trouble indenting the second piece of code properly for HN than the first.