> If it's there it's either for speed and to avoid code duplication ; both are 
> very good reasons.

I think the reason is avoiding code duplication.
Templates were also designed to help with this.


ps:
There is some hype about template metaprogramming now.
A lot of people do weird things with templates.
(e.g: http://www.boost.org/libs/mpl/doc/index.html)

Something simple but unfamiliar:

  template <int d>
  int inc( int& a ) {
    return a+=d;
  }
  ...
  int n=7;
  std::cout <<  inc<4>(n);

Real C++ code, but the "int" keyword instead of "class"
or "typename" looks very strange to me.

-- 
Kai Antweiler


_______________________________________________
glob2-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/glob2-devel

Reply via email to