Here’s another post in the series, this time it’s C++ vs. the D programming language.
Let’s talk about templates.
If you’ve ever tried templates in C++ you surely as hell recall the pages and PAGES of compiler errors and seemingly random placement of typename keyword.
Trust me, there are EVEN WORSE problems with templates in C++… Consider the following:
1: struct Foo { 2: template<int N> 3: void bar() {} 4: 5: template<int N> 6: struct Bar {}; 7: }; 8: 9: template<typename T> 10: void f() { 11: T foo; 12: foo.template bar<0>(); 13: typename T::template Bar<0> b; 14: } 15: 16: int main() { 17: f<Foo>(); 18: } 19:

